Expiration time of docs with DP4
I just set a key with an expiration time:
client.set('my-sample-expication', JSON.stringify(view), function(error, result) {
client.close();
console.log(error, result);
res.send(200);
}, 60);In the document it says:
"$expiration": 0
The document gets deleted if requested after the expiration time, so not automatically after 60 seconds?
Thanks, that's good to know!
1. The first way is the way you mentioned. If you do a get on an expired item then it will be deleted.
2. Couchbase has an expiry pager which periodically iterates through all of the data and looks for expired items. By default this pager run every 60 minutes, but it can be configured to run at different intervals. If you interested in how to change this setting I can provide an example.
Hi Mike,
Do you think you could get the documentation updated to reflect that?
From my reading of this page, it sounded like items would only ever be deleted when retrieved..
http://www.couchbase.com/docs/couchbase-manual-1.8//couchbase-developing...
Sure. I will pass this on to our documentation people. Thanks for pointing this out.\
The docs have been updated to reflect the information in this forum post.
Document deletion is lazy in Couchbase and there are two ways an item can be deleted after it expires.
1. The first way is the way you mentioned. If you do a get on an expired item then it will be deleted.
2. Couchbase has an expiry pager which periodically iterates through all of the data and looks for expired items. By default this pager run every 60 minutes, but it can be configured to run at different intervals. If you interested in how to change this setting I can provide an example.