From fbcf2a8e1c041b5cf6e9611d4e78d291f591a663 Mon Sep 17 00:00:00 2001 From: MGatner Date: Wed, 5 May 2021 13:09:49 +0000 Subject: [PATCH] Use prefix in key validation --- system/Cache/Handlers/WincacheHandler.php | 24 +++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/system/Cache/Handlers/WincacheHandler.php b/system/Cache/Handlers/WincacheHandler.php index 3c8af823d384..eb4762d16f6d 100644 --- a/system/Cache/Handlers/WincacheHandler.php +++ b/system/Cache/Handlers/WincacheHandler.php @@ -51,10 +51,10 @@ public function initialize() */ public function get(string $key) { - $key = static::validateKey($key); + $key = static::validateKey($this->prefix . $key); $success = false; - $data = wincache_ucache_get($this->prefix . $key, $success); + $data = wincache_ucache_get($key, $success); // Success returned by reference from wincache_ucache_get() return $success ? $data : null; @@ -73,9 +73,9 @@ public function get(string $key) */ public function save(string $key, $value, int $ttl = 60) { - $key = static::validateKey($key); + $key = static::validateKey($this->prefix . $key); - return wincache_ucache_set($this->prefix . $key, $value, $ttl); + return wincache_ucache_set($key, $value, $ttl); } //-------------------------------------------------------------------- @@ -89,9 +89,9 @@ public function save(string $key, $value, int $ttl = 60) */ public function delete(string $key) { - $key = static::validateKey($key); + $key = static::validateKey($this->prefix . $key); - return wincache_ucache_delete($this->prefix . $key); + return wincache_ucache_delete($key); } //-------------------------------------------------------------------- @@ -120,9 +120,9 @@ public function deleteMatching(string $pattern) */ public function increment(string $key, int $offset = 1) { - $key = static::validateKey($key); + $key = static::validateKey($this->prefix . $key); - return wincache_ucache_inc($this->prefix . $key, $offset); + return wincache_ucache_inc($key, $offset); } //-------------------------------------------------------------------- @@ -137,9 +137,9 @@ public function increment(string $key, int $offset = 1) */ public function decrement(string $key, int $offset = 1) { - $key = static::validateKey($key); + $key = static::validateKey($this->prefix . $key); - return wincache_ucache_dec($this->prefix . $key, $offset); + return wincache_ucache_dec($key, $offset); } //-------------------------------------------------------------------- @@ -183,9 +183,9 @@ public function getCacheInfo() */ public function getMetaData(string $key) { - $key = static::validateKey($key); + $key = static::validateKey($this->prefix . $key); - if ($stored = wincache_ucache_info(false, $this->prefix . $key)) + if ($stored = wincache_ucache_info(false, $key)) { $age = $stored['ucache_entries'][1]['age_seconds']; $ttl = $stored['ucache_entries'][1]['ttl_seconds'];