Skip to content

Commit

Permalink
Use prefix in key validation
Browse files Browse the repository at this point in the history
  • Loading branch information
MGatner committed May 5, 2021
1 parent 01f8b4b commit fbcf2a8
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions system/Cache/Handlers/WincacheHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}

//--------------------------------------------------------------------
Expand All @@ -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);
}

//--------------------------------------------------------------------
Expand Down Expand Up @@ -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);
}

//--------------------------------------------------------------------
Expand All @@ -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);
}

//--------------------------------------------------------------------
Expand Down Expand Up @@ -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'];
Expand Down

0 comments on commit fbcf2a8

Please sign in to comment.