Varun Verma
Varun Verma

Reputation: 501

Couchbase - On ttl expire how to save document on another server or couchbase instance?

I want to achieve this : I have a couchbase instance and it has buckets and documents . As soon as ttl of a key or document is about to expire , the couch base server make a call(Post request) to another server with key and its data and that server will save it in another couchbase instance .

So there are two questions : 1) How can i configure couchbase to make a post request to another server with key and data it contains . 2) Is there a better way in couch base to attain this thing ? i mean , i dont have to make a rest api for couchbase to send data , it can some how save data to another server by itself , just by doing some configurations ?

Upvotes: 1

Views: 412

Answers (1)

theMayer
theMayer

Reputation: 16177

The simple answer to your question is that this is not possible.

First, Couchbase doesn't evict things from the data set the instant they expire. Rather, it has a background process that trims the expired items out periodically, or expired items are removed when they are accessed, whichever occurs first.

Next, I am not sure it make sense to have data expire if you want to keep it. Couchbase offers an efficient disk-storage mechanism. Keep in mind that only the most frequently-accessed data is kept in RAM, should the data size exceed the RAM capacity; furthermore, on node startup, data is loaded in order of most frequent/recent to less frequent/older.

If your data must be stored in two separate databases, it is up to your application logic to make that happen when saving the data.

Upvotes: 2

Related Questions