Skip to content

Commit 00f5654

Browse files
authored
Merge pull request #426 from Geolim4/final
Fixed issue #423 // Couchbase key must not exceed 250 bytes
2 parents f532e2e + 389bc11 commit 00f5654

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/phpFastCache/Drivers/Couchbase/Driver.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ protected function driverWrite(CacheItemInterface $item)
7878
* Check for Cross-Driver type confusion
7979
*/
8080
if ($item instanceof Item) {
81-
return $this->getBucket()->upsert($item->getKey(), $this->encode($this->driverPreWrap($item)), ['expiry' => $item->getTtl()]);
81+
return $this->getBucket()->upsert(md5($item->getKey()), $this->encode($this->driverPreWrap($item)), ['expiry' => $item->getTtl()]);
8282
} else {
8383
throw new \InvalidArgumentException('Cross-Driver type confusion detected');
8484
}
@@ -94,7 +94,7 @@ protected function driverRead(CacheItemInterface $item)
9494
/**
9595
* CouchbaseBucket::get() returns a CouchbaseMetaDoc object
9696
*/
97-
return $this->decode($this->getBucket()->get($item->getKey())->value);
97+
return $this->decode($this->getBucket()->get(md5($item->getKey()))->value);
9898
} catch (\CouchbaseException $e) {
9999
return null;
100100
}
@@ -111,7 +111,7 @@ protected function driverDelete(CacheItemInterface $item)
111111
* Check for Cross-Driver type confusion
112112
*/
113113
if ($item instanceof Item) {
114-
return $this->getBucket()->remove($item->getKey());
114+
return $this->getBucket()->remove(md5($item->getKey()));
115115
} else {
116116
throw new \InvalidArgumentException('Cross-Driver type confusion detected');
117117
}

0 commit comments

Comments
 (0)