I plan to use couchbase bucket for caching results from database calls. If one of the couchbase server in cluster goes down and starts back, I want to force expiration of any persisted documents on that server. How can I do that? How is the performance of memcached bucket compared to couchbase bucket?
1
votes
You use-case sounds strange - perhaps you could explain why you want to do such a thing? The typical way of ensuring consistency with Couchbase is to set up one of more replicas; so as/when a node goes down the replica will be promoted and the data will still be available (and consistent).
- DaveR
Scenario: I'd like to use couchbase without replica as cache for data fetched from SQL database. Users could be making updates to SQL db and cache should be invalidated. My cache expiration policy is 10 minutes. If the cache server is down for 5 minutes, oldest 5 minutes of data is expired, it is possible that remaining 5 minutes of data is invalid due to SQL updates (which we don't know). So I want to start with empty cache if there is a server restart. HTH!
- frosty
2 Answers
0
votes
0
votes
There's no support to flush just a single nodes' vbuckets, but you can flush the whole Bucket (across all nodes) by simply deleting and re-creating the Bucket.
This can be done using the REST API - see Deleting a Bucket and Creating and Editing a Bucket. You may also have this wrapped up in an SDK call, depending on which SDK you're using.