Couchbase Retrieved Document Expiry always set to 0

Viewed 722

It seems like the document expiry value is always retrieved as "0" by the couchbase client, although obviously it is taken into account. Any ideas ? (Using couchbase Java Client 2.2.8)

bucket.upsert(JsonDocument.create(key, 5, content));

    try {
        for (int i = 0; i < 10; i++) {
            Thread.sleep(1000);             
            print("expiry :" + bucket.get(key).expiry());
        }
    } catch (NullPointerException e) {
        print("Document Expired");
    }

Code Output :

expiry :0
expiry :0
expiry :0
expiry :0
expiry :0
Document Expired

2 Answers

See comment in Couchbase Forum post

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

I think it is strange (indeed a bug) since the SDK documentation makes me believe Java client can read the document expiry....

Related