I just ran the code I gave on a 7.X beta couchbase-server with Python 2.7.16
>>> cb.upsert('SampleDocument2', {'a_key': 'a_value'})
OperationResult<rc=0x0, key=u'SampleDocument2', cas=0x1664978a28590000, tracing_context=0, tracing_output={'c': '0000000063852732/746cc529859d69aa', 'b': 'source', 'i': 8409897855176612071L, 'l': '127.0.0.1:42980', 's': 'kv:Unknown', 'r': 'localhost:11210', 't': 2500000L}>
>>> cb.touch('SampleDocument2', ttl=10*60)
OperationResult<rc=0x0, key=u'SampleDocument2', cas=0x1664978a28650000, tracing_context=0, tracing_output={'c': '0000000063852732/746cc529859d69aa', 'b': 'source', 'i': 16510411910136738598L, 'l': '127.0.0.1:42980', 's': 'kv:Unknown', 'r': 'localhost:11210', 't': 2500000L}>
>>>
As you can see I inserted my document (above) the response does not have the TTL, then I used the UI and looked at the document itself and specifically it’s meta data and I see the “expiration”: 1613581785 as expected seconds since epoch.
{
"meta": {
"id": "SampleDocument2",
"rev": "4-1664978a28650000602d4dd902000000",
"expiration": 1613581785,
"flags": 33554432,
"type": "json"
},
"xattrs": {}
}
And after 10 minutes the document was gone when I accessed it the UI again. You might want to test with something smaller say 60 seconds:
cb.touch(‘SampleDocument2’, ttl=60)
Note I only have tested the script I gave you with version 6.5 and 7.X beta, I don’t run 6.0.1 as it’s quite old. But it should work as the docs seem to be unchanged WRT touch.