File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
lib/Phpfastcache/Extensions/Drivers/Couchbasev4 Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -263,7 +263,7 @@ protected function driverWrite(ExtendedCacheItemInterface $item): bool
263
263
$ this ->getCollection ()->upsert (
264
264
$ item ->getEncodedKey (),
265
265
$ this ->encodeDocument ($ this ->driverPreWrap ($ item )),
266
- (new UpsertOptions ())->expiry ($ item ->getTtl ())
266
+ (new UpsertOptions ())->expiry ($ item ->getExpirationDate ())
267
267
);
268
268
return true ;
269
269
} catch (CouchbaseException ) {
Original file line number Diff line number Diff line change 70
70
$ cache1 ->set ('forkSuccessTestKey1 ' , $ value1 );
71
71
$ cache2 ->set ('forkSuccessTestKey2 ' , $ value2 );
72
72
73
+ // 1576800000 is the int limit within Couchbase for the ttl before the need to use DateTime
74
+ // so using an int like '\time() + 3600' would produce an error, to reproduce the error
75
+ // within phpFastCache we need to push the date 1576800001s in the future to overflow the ttl int
76
+ if ($ cache ->set ('bigTTL ' , 'test ' , new DateInterval ('PT1576800001S ' ))) {
77
+ $ testHelper ->assertPass ('Set with large ttl succeeded ' );
78
+ } else {
79
+ $ testHelper ->assertFail ('Set with large ttl failed ' );
80
+ }
81
+
73
82
try {
74
83
\Phpfastcache \Extensions \Drivers \Couchbasev4 \Driver::prepareToFork ();
75
84
$ pid = \pcntl_fork ();
You can’t perform that action at this time.
0 commit comments