What is the "exptime" unit in "lcb_store_cmd_t"? Seconds, Milliseconds or others?

I want to confirm the "exptime" unit in "lcb_store_cmd_t".

I can NOT get the definite unit information from lcb_store api html(here: http://www.couchbase.com/autodocs/couchbase-c-client-2.1.3/lcb_store.3co...).

Although I have read the expiration explanation in the devguide (here: http://docs.couchbase.com/couchbase-devguide-2.1/#about-document-expiration), I can NOT confirm that the exptime unit is seconds.

I want to set the expiry time as two days ( 172800seconds), so I assign the exptime param with 172800, then call lcb_store. Is this OK?

1 Answer

« Back to question.

I can NOT get the definite unit information from lcb_store api html(here: http://www.couchbase.com/autodocs/couchbase-c-client-2.1.3/lcb_store.3co...

This argument described in lcb_touch(3) docs http://www.couchbase.com/autodocs/couchbase-c-client-2.1.3/lcb_touch.3co...

Although I have read the expiration explanation in the devguide (here: http://docs.couchbase.com/couchbase-devguide-2.1/#about-document-expiration), I can NOT confirm that the exptime unit is seconds.

Can you confirm the opposite?

I want to set the expiry time as two days ( 172800seconds), so I assign the exptime param with 172800, then call lcb_store. Is this OK?

Yes it is perfectly valid. Values of exptime larger than 30*24*60*60 seconds (30 days) are interpreted as absolute times (from the epoch). As far as yours is just 2 days, you can use the relative time.

Also make sure that clocks on your nodes are synchronized, because internally the server will convert your relative time to absolute anyway.

Thank you.

In fact, before asking this question, I have coded a UnitTest to validate the exptime is seconds.
However, we find a exptime problem in our couchbase server group: some data are not existed before arriving at the expiry time point. I just want to ensure the unit.

We will look for other reasons about this problem.

Could you probably share the test so that we can reproduce it?