File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
src/phpFastCache/Drivers/Couchbase Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -78,7 +78,11 @@ protected function driverWrite(CacheItemInterface $item)
7878 * Check for Cross-Driver type confusion
7979 */
8080 if ($ item instanceof Item) {
81- return $ this ->getBucket ()->upsert ($ item ->getEncodedKey (), $ this ->encode ($ this ->driverPreWrap ($ item )), ['expiry ' => $ item ->getTtl ()]);
81+ try {
82+ return (bool )$ this ->getBucket ()->upsert ($ item ->getEncodedKey (), $ this ->encode ($ this ->driverPreWrap ($ item )), ['expiry ' => $ item ->getTtl ()]);
83+ } catch (\CouchbaseException $ e ) {
84+ return false ;
85+ }
8286 } else {
8387 throw new phpFastCacheInvalidArgumentException ('Cross-Driver type confusion detected ' );
8488 }
@@ -111,7 +115,11 @@ protected function driverDelete(CacheItemInterface $item)
111115 * Check for Cross-Driver type confusion
112116 */
113117 if ($ item instanceof Item) {
114- return $ this ->getBucket ()->remove ($ item ->getEncodedKey ());
118+ try {
119+ return (bool )$ this ->getBucket ()->remove ($ item ->getEncodedKey ());
120+ } catch (\Couchbase \Exception $ e ) {
121+ return $ e ->getCode () === COUCHBASE_KEY_ENOENT ;
122+ }
115123 } else {
116124 throw new phpFastCacheInvalidArgumentException ('Cross-Driver type confusion detected ' );
117125 }
You can’t perform that action at this time.
0 commit comments