So I’ve been using Couchbase for a few months, and I’m having an issue with document expiry.
I’m calling the following code:
$connection = new \CouchbaseCluster(SYS_COUCHBASE_HOSTS);
$bucket = $connection->openBucket(‘cache’, SYS_COUCHBASE_PASSWORD);
$bucket->insert(‘abc123’, [‘value’ => 123456], [‘expires’ => 3]);
sleep(10);
print_r($bucket->get(‘abc123’));
And I get the value I put in back - this seems completely wrong to me!
This happens for both couchbase AND memcache buckets; and if I specific expiry as 3 or time()+3 (should be the same, according to docs) - it just never expires. Even 24 hours later the same value is in the database.
However…
In the same Couchbase instance, I have a default bucket using the memcached PHP extensions, and the serialized sessions are correctly expired here - so this point to being a PHP Extension issue to me…
PHP version: 5.6.9, 5.6.11, 5.6.12 (tried on multiple machines)
Couchbase PHP Extension version: 2.0.7
Libcouchbase version: 2.4.1 or 2.4.9
Server version: 3.0.1 Community Edition (build-1444).
Any ideas?
Thanks,
Joe