Created
November 18, 2017 13:10
-
-
Save Geolim4/9ed87170ff6f6c2121e58697efd7e48b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Trying now..