how can i know the value is expired

I save a value with expired time, for excample,100 seconds. then after 100 seconds, how can i konw the expired event. via program or log all ok.

2 Answers

« Back to question.

the expiration time means, that the key won't be accessible when this amount time pass. If I got you correctly, you need to get value of the expired key? Why not just increase it's expiration time? There are two options to do this:

1) lcb_touch, which will amend the expiration time
http://www.couchbase.com/autodocs/couchbase-c-client-2.1.0/lcb_touch.3co...

2) lcb_get with exptime set to non-zero
http://www.couchbase.com/autodocs/couchbase-c-client-2.1.0/lcb_get.3couc...

« Back to question.

Hello,

Just to a get(key) and if the key has expired it will return null. If your values/documents are small the impact will be really small.

If the values/documents are big you can check if the value exists. Which SDK are you using? What are the type of value you are storing (JSON/Other) and size?

Regards
Tug
@tgrall

thank you for your answer, now i want to know the expired log.where can i find it. "/opt/couchbase/var/lib/couchbase/logs/couchdb.1" only contain web console log.

This information is not logged.

i use c sdk. is there any approach to know which key has expired auto.
i dont want to use get(key) or observe.
thank you.