"append" does not support setting ttl (although stated in the documentation)

#1

Hi!

According to the documentation
http://www.couchbase.com/autodocs/couchbase-python-client-1.2.0/html/api/couchbase.html#couchbase.connection.Connection.append
the append method allows to set a ttl.
However, with the python client version I am using (lcb_version=2.4.9), ttl is not supported:

connection.append('key', 'value', ttl=1000)
TypeError: append() got an unexpected keyword argument 'ttl'

So does “append” change the ttl of the document, or not?

Thanks!

#2

The low-level binary protocol doesn’t include a TTL in APPEND or PREPEND requests (see https://github.com/couchbase/memcached/blob/master/include/memcached/protocol_binary.h#L722), so there’s no way the Python SDK could do it.

Therefore it sounds like there’s a documentation bug in the Python SDK.

#3

This has been fixed in the Python SDK since version 2.x and ttl is no longer accepted as input for append/prepend. Indeed the ttl parameter is not present in the newer documentation: http://pythonhosted.org/couchbase/api/couchbase.html#couchbase.bucket.Bucket.append

#4

Thank you for the info!

So what is then semantics of append, when it comes to the ttl:

conn.set(key, value, ttl=1000)

conn.append(key, value_to_append)

  1. Is the time - when the document expires - updated when append is called?
  2. Or does the document expire after 1000 seconds even if I append something to it all the time.

Many thanks!

#5

I think it’s (1) - i.e. at append the TTL will be reset to zero (i.e. keep forever). It should be straightforward for you to write a simple test to verify this, though.