User sessions are easily stored in Couchbase, such as by using a document ID naming scheme like "user:USERID". The item expiration feature of Couchbase can be optionally used to have Couchbase automatically delete old sessions. There are two ways that Couchbase Server will remove items that have expired:
Lazy Deletion: when a key is requested Couchbase Server checks a key for expiration; if a key is past its expiration Couchbase Server removes it from RAM. This applies to data in Couchbase and memcached buckets.
Maintenance Intervals: items that have expired will be removed by an automatic maintenance process that runs every 60 minutes.
When Couchbase Server gets a requests for a key that is past its expiration it removes it from RAM; when a client tries to retrieve the expired item, Couchbase Server will return a message that the key does not exist. Items that have expired but have not been requested will be removed every 60 minutes by default by an automatic maintenance process.
Besides the usual SET operation, CAS identifiers can be used to ensure concurrent web requests from a single user do not lose data.
Many web application frameworks such as Ruby on Rails and various PHP and Python web frameworks also provide pre-integrated support for storing session data using Memcached protocol. These are supported automatically by Couchbase.