Expiration

Expiration

Each document stored in the database has an optional expiration value (TTL, Time To Live) that is used to automatically delete items.

The expiration option can be used for data that has a limited life and could be automatically deleted.

The expiration value is user specified on a per document basis at the point when the object is created, updated, or changed through the Couchbase SDK.

If you want an object to expire before 30 days, you can provide a TTL in seconds, or as Unix epoch time. If you want an object to expire sometime after 30 days, you must provide a TTL in Unix epoch time; for example, 1 095 379 198 indicates the seconds since 1970.

The default is no expiration, that is, the information is stored indefinitely. Typical uses for an expiration value include web session data, where the actively stored information needs to be removed from the system once the user activity has stopped. With an expiration value, the data times out and is removed from the system without being explicitly deleted. This frees up RAM and disk for more active data.