Expiry always is 0


#1

I’m following the couchbase jdk document to set expiry.

int expiry = 180;
bucket.upsert(JsonDocument.create(documentId, expiry, data));

Key:270006254971 value:JsonDocument{id=‘testing0’, cas=12707951742556403, expiry=0, content={“creationDate”:“2016-07-25T14:46:08-0700”,“siteId”:0,“review_count”:2,“expireDate”:“2016-09-23T14:46:08-0700”,“domain”:“review”,“itemId”:“270006254971”,“autoTagProductId”:“1602901284”,“caseName”:“AddReviews_testing”}, mutationToken=null}

When I get the document.content. the expiry is always 0. However, after 3 minutes. The data is gone. I’m not sure if it’s a bug.

Thanks


How set expiry for memcached couchbase bucket documents in java
#2

Yes, this is expected and not a bug since the get call underneath from the server doesn’t return the expiration time.


#3

Is there a way we can get the expiry time? I am creating a SerializableDocument to store the serialize objects.


#4

Ok, I got it by creating a view with the required meta data.