How set expiry for memcached couchbase bucket documents in java
I set like the following but it doesn’t change anything, always says expiry=0
bucket.getAndTouch(“id_3”, 5601000);
If I set the expiry for an existing document using touch OR getAndTouch method, it doesn’t show the updated expiry when I get after upsert, it always shows “0”. What is the issue here??
Kindly take look into it.
Thank you!
The expiry field is not populated when the document is read; it’s only used when the document is inserted/upserted. You’re not the first to be surprised by this; see: Expiry always is 0
If you experiment by setting a short expiry, I’d wager you’ll see the documents disappearing from your bucket (unless you call touch/getAndTouch).
Note that upserting clears the expiry, unless you set an expiry when upserting.
Ok, understood… Thank you @david.nault !