8000 [Cache] Fix expiration time for CouchbaseCollection · symfony/symfony@b958250 · GitHub
[go: up one dir, main page]

Skip to content

Commit b958250

Browse files
[Cache] Fix expiration time for CouchbaseCollection
1 parent 1aa17b8 commit b958250

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/Symfony/Component/Cache/Adapter/CouchbaseCollectionAdapter.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class CouchbaseCollectionAdapter extends AbstractAdapter
3535
public function __construct(Collection $connection, string $namespace = '', int $defaultLifetime = 0, MarshallerInterface $marshaller = null)
3636
{
3737
if (!static::isSupported()) {
38-
throw new CacheException('Couchbase >= 3.0.0 < 4.0.0 is required.');
38+
throw new CacheException('Couchbase >= 3.0.5 < 4.0.0 is required.');
3939
}
4040

4141
$this->maxIdLength = static::MAX_KEY_LENGTH;
@@ -54,7 +54,7 @@ public static function createConnection(#[\SensitiveParameter] array|string $dsn
5454
}
5555

5656
if (!static::isSupported()) {
57-
throw new CacheException('Couchbase >= 3.0.0 < 4.0.0 is required.');
57+
throw new CacheException('Couchbase >= 3.0.5 < 4.0.0 is required.');
5858
}
5959

6060
set_error_handler(function ($type, $msg, $file, $line): bool { throw new \ErrorException($msg, 0, $type, $file, $line); });
@@ -183,7 +183,7 @@ protected function doSave(array $values, $lifetime): array|bool
183183
}
184184

185185
$upsertOptions = new UpsertOptions();
186-
$upsertOptions->expiry($lifetime);
186+
$upsertOptions->expiry((new \DateTimeImmutable())->modify("+$lifetime seconds"));
187187

188188
$ko = [];
189189
foreach ($values as $key => $value) {

src/Symfony/Component/Cache/Tests/Adapter/CouchbaseCollectionAdapterTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
/**
2020
* @requires extension couchbase <4.0.0
21-
* @requires extension couchbase >=3.0.0
21+
* @requires extension couchbase >=3.0.5
2222
*
2323
* @group integration
2424
*
@@ -36,7 +36,7 @@ class CouchbaseCollectionAdapterTest extends AdapterTestCase
3636
public static function setupBeforeClass(): void
3737
{
3838
if (!CouchbaseCollectionAdapter::isSupported()) {
39-
self::markTestSkipped('Couchbase >= 3.0.0 < 4.0.0 is required.');
39+
self::markTestSkipped('Couchbase >= 3.0.5 < 4.0.0 is required.');
4040
}
4141

4242
self::$client = AbstractAdapter::createConnection('couchbase://'.getenv('COUCHBASE_HOST').'/cache',
@@ -47,7 +47,7 @@ public static function setupBeforeClass(): void
4747
public function createCachePool($defaultLifetime = 0): CacheItemPoolInterface
4848
{
4949
if (!CouchbaseCollectionAdapter::isSupported()) {
50-
self::markTestSkipped('Couchbase >= 3.0.0 < 4.0.0 is required.');
50+
self::markTestSkipped('Couchbase >= 3.0.5 < 4.0.0 is required.');
5151
}
5252

5353
$client = $defaultLifetime

0 commit comments

Comments
 (0)
0