Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c7f40f3

Browse filesBrowse files
bug #53054 [Cache] Fix expiration time for CouchbaseCollection (alexandre-daubois)
This PR was merged into the 6.3 branch. Discussion ---------- [Cache] Fix expiration time for CouchbaseCollection | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | - | License | MIT A refactoring has been done in Couchbase extension 3.0.5 about expiry time: https://github.com/couchbase/php-couchbase/releases/tag/v3.0.5 (see PCBC-715) In order to put things together, let's constantly use an absolute time point here. This also fixes a failing test of integration tests in 6.3. Tests skipping messages have been updated to match `CouchbaseCollectionAdapter::isSupported()`. Commits ------- e286f38 [Cache] Fix expiration time for CouchbaseCollection
2 parents 64f6ac2 + e286f38 commit c7f40f3
Copy full SHA for c7f40f3

File tree

2 files changed

+6
-6
lines changed
Filter options

2 files changed

+6
-6
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Adapter/CouchbaseCollectionAdapter.php
+3-3Lines changed: 3 additions & 3 deletions
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(time() + $lifetime);
187187

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

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Tests/Adapter/CouchbaseCollectionAdapterTest.php
+3-3Lines changed: 3 additions & 3 deletions
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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.