PHP SDK 2.0.6 - setting expiration


#1

Hi,
I’m working on a session handler for PHP using the php-pecl-couchbase2 package, SDK version 2.0.6

I have a problem setting expiration of documents when calling the upsert() function. If I supply the expiration as a number, then it goes into Couchbase, but PHP throws error : Options argument must be an associative array.
When supplying as an associative array then no error, but the expiration gets set to 0.

Option I:

$this->_bucket->upsert($sessionID,$json_data, 100);
This sets the lifetime correctly in the Couchbase bucket, but PHP throws: Options argument must be an associative array.

Option II:

$this->_bucket->upsert($sessionID,$json_data, array(‘expiration’ => 100));
This does not throw error, but it does not set the expiration date in the Couchbase bucket - or actually sets it to the default 0.

I have looked at the documentation but did not see anywhere what should be the proper way of settings expiration.

Also, another question re expiration: how to read the expiration of a document?


#2

Sorry, figured it out, the associative array should refer to the expiration as “expiry” and not as “expiration”.

Now the only question left is how to read the expiration of a document.