Time to live can be a bit confusing for developers at first. There are many cases where you may set an expiration to be 30 seconds, but the record may still exist on disk after expiration.
There are two ways that Couchbase Server will remove items flagged for deletion:
Lazy Deletion: key are flagged for deletion; after the next request for the key, it will be removed. This applies to data in Couchbase and memcached buckets.
Maintenance Intervals: items flagged as expired will be removed by an automatic maintenance process that runs every 60 minutes.
When Couchbase Server performs lazy deletion, it flags an item
as deleted when the server receives a delete request; later when
a client tries to retrieve the item, Couchbase Server will
return a message that the key does not exist and actually delete
the item. Items that are flagged as expired will be removed
every 60 minutes by default by an automatic maintenance process.
To update the interval for this maintenance, you would set
exp_pager_stime:
./cbconfig localhost:11210 set flush exp_pager_stime 7200This updates the maintenance program so that it runs every two hours on the default bucket.