From 3dc21b45a2515a4b8fea9f6a497d6e05a95565d5 Mon Sep 17 00:00:00 2001 From: "Rood Fruit B.V" Date: Thu, 26 Sep 2024 08:57:35 +0200 Subject: [PATCH] [11.x] Align all Cache stores to work the same way regarding forget() See https://github.com/laravel/framework/pull/52891 Signed-off-by: Rood Fruit B.V --- src/Illuminate/Cache/ApcStore.php | 2 ++ src/Illuminate/Cache/DynamoDbStore.php | 9 +++++++++ src/Illuminate/Cache/MemcachedStore.php | 2 ++ src/Illuminate/Cache/RedisStore.php | 2 ++ 4 files changed, 15 insertions(+) diff --git a/src/Illuminate/Cache/ApcStore.php b/src/Illuminate/Cache/ApcStore.php index 8bba88b50708..2ea8561d43b0 100755 --- a/src/Illuminate/Cache/ApcStore.php +++ b/src/Illuminate/Cache/ApcStore.php @@ -101,6 +101,8 @@ public function forever($key, $value) */ public function forget($key) { + $this->apc->delete("{$this->prefix}illuminate:cache:flexible:created:{$key}"); + return $this->apc->delete($this->prefix.$key); } diff --git a/src/Illuminate/Cache/DynamoDbStore.php b/src/Illuminate/Cache/DynamoDbStore.php index 88c7cf3be436..e8a51a2cf8ff 100644 --- a/src/Illuminate/Cache/DynamoDbStore.php +++ b/src/Illuminate/Cache/DynamoDbStore.php @@ -435,6 +435,15 @@ public function restoreLock($name, $owner) */ public function forget($key) { + $this->dynamo->deleteItem([ + 'TableName' => $this->table, + 'Key' => [ + $this->keyAttribute => [ + 'S' => "{$this->prefix}illuminate:cache:flexible:created:{$key}", + ], + ], + ]); + $this->dynamo->deleteItem([ 'TableName' => $this->table, 'Key' => [ diff --git a/src/Illuminate/Cache/MemcachedStore.php b/src/Illuminate/Cache/MemcachedStore.php index 88198d9222bf..a0c2310ada79 100755 --- a/src/Illuminate/Cache/MemcachedStore.php +++ b/src/Illuminate/Cache/MemcachedStore.php @@ -211,6 +211,8 @@ public function restoreLock($name, $owner) */ public function forget($key) { + $this->memcached->delete("{$this->prefix}illuminate:cache:flexible:created:{$key}"); + return $this->memcached->delete($this->prefix.$key); } diff --git a/src/Illuminate/Cache/RedisStore.php b/src/Illuminate/Cache/RedisStore.php index f953d30d5857..4e4fd4a8f54f 100755 --- a/src/Illuminate/Cache/RedisStore.php +++ b/src/Illuminate/Cache/RedisStore.php @@ -235,6 +235,8 @@ public function restoreLock($name, $owner) */ public function forget($key) { + $this->connection()->del("{$this->prefix}illuminate:cache:flexible:created:{$key}"); + return (bool) $this->connection()->del($this->prefix.$key); }