I am using Couchbase server for session management with Java SDK client, I have one bucket for session storage.
Currently I am using Time to Live on each document to set expiration time for each session. I have a new requirement where I need to set the session to expire after 120 second but if the session is updated (touched) it will be extended for another 120 seconds, after 24 hours the session should be forced to expire.
How can I configure all Bucket documents to expire (after 24 hours) and keep current session document to expire after 120 seconds?
Based on the comments I was going to simply suggest setting a TTL for a long period of time. Would that not work?
EDIT: I missed the spirit of the question. No, it would not work for what you're trying to do. I think you could set a TTL attribute in the json doc itself and enforce an expiry at the application level by checking this particular attribute in conjunction with setting a Couchbase TTL on the doc.
EDIT 2: Ok, I re-read Simon's reply. You got it. :)