Skip to content

Instantly share code, notes, and snippets.

@Geolim4
Created November 18, 2017 13:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Geolim4/9ed87170ff6f6c2121e58697efd7e48b to your computer and use it in GitHub Desktop.
Save Geolim4/9ed87170ff6f6c2121e58697efd7e48b to your computer and use it in GitHub Desktop.
Index: src/phpFastCache/Drivers/Couchbase/Driver.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/phpFastCache/Drivers/Couchbase/Driver.php (revision 6e6ec8d6d3dddfe102a52b87f6de06e91f3e52a2)
+++ src/phpFastCache/Drivers/Couchbase/Driver.php (revision )
@@ -109,7 +109,11 @@
* Check for Cross-Driver type confusion
*/
if ($item instanceof Item) {
- return (bool)$this->getBucket()->upsert($item->getEncodedKey(), $this->encode($this->driverPreWrap($item)), ['expiry' => $item->getTtl()]);
+ try {
+ return (bool)$this->getBucket()->upsert($item->getEncodedKey(), $this->encode($this->driverPreWrap($item)), ['expiry' => $item->getTtl()]);
+ } catch (\CouchbaseException $e) {
+ return false;
+ }
} else {
throw new phpFastCacheInvalidArgumentException('Cross-Driver type confusion detected');
}
@@ -126,7 +130,11 @@
* Check for Cross-Driver type confusion
*/
if ($item instanceof Item) {
- return (bool)$this->getBucket()->remove($item->getEncodedKey());
+ try{
+ return (bool)$this->getBucket()->remove($item->getEncodedKey());
+ }catch (\Couchbase\Exception $e){
+ return $e->getCode() === COUCHBASE_KEY_ENOENT;
+ }
} else {
throw new phpFastCacheInvalidArgumentException('Cross-Driver type confusion detected');
}
@rdecourtney
Copy link

Trying now..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment