From db19ca6ecc0ee51c70841cd01e3c4822b95d9acf Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Mon, 22 Jul 2024 17:58:38 +0700 Subject: [PATCH] Fixed some cache issues (#1557) * Fixed some cache issues * Update CHANGELOG.md --- CHANGELOG.md | 2 +- src/Legacy/Cache/APCu.php | 4 ++-- src/Legacy/Cache/File.php | 4 ++-- src/Legacy/Cache/Memcached.php | 4 ++-- src/Legacy/Cache/Redis.php | 4 ++-- src/Legacy/Cache/Sqlite.php | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 50773155d..413c15e3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ - Release 2.4.4 🦩 ([belomaxorka](https://github.com/belomaxorka)) - Supports PHP 8.2 / PHP 8.3 ([belomaxorka](https://github.com/belomaxorka)) - CWE-502 Fixed: Deserialization of untrusted data ([belomaxorka](https://github.com/belomaxorka)) -- Refactored cache drivers 🗃 [\#1553](https://github.com/torrentpier/torrentpier/pull/1553) ([belomaxorka](https://github.com/belomaxorka)) +- Refactored cache drivers 🗃 [\#1553](https://github.com/torrentpier/torrentpier/pull/1553), [\#1557](https://github.com/torrentpier/torrentpier/pull/1557) ([belomaxorka](https://github.com/belomaxorka)) - Create tech stack docs (techstack.yml and techstack.md) [\#1521](https://github.com/torrentpier/torrentpier/pull/1521), [\#1522](https://github.com/torrentpier/torrentpier/pull/1522) ([belomaxorka](https://github.com/belomaxorka)) - Added MonsterID avatars support 🎇 [\#1546](https://github.com/torrentpier/torrentpier/pull/1546) ([belomaxorka](https://github.com/belomaxorka)) - Added ability to reset ratio [\#1545](https://github.com/torrentpier/torrentpier/pull/1545) ([belomaxorka](https://github.com/belomaxorka)) diff --git a/src/Legacy/Cache/APCu.php b/src/Legacy/Cache/APCu.php index d7f73d0da..3af2d321e 100644 --- a/src/Legacy/Cache/APCu.php +++ b/src/Legacy/Cache/APCu.php @@ -114,9 +114,9 @@ class APCu extends Common public function rm(string $name = null): bool { $targetMethod = is_string($name) ? 'delete' : 'flush'; - $name = is_string($name) ? ("'" . $this->prefix . $name . "'") : null; + $name = is_string($name) ? $this->prefix . $name : null; - $this->cur_query = "cache->$targetMethod($name)"; + $this->cur_query = "cache->$targetMethod('$name')"; $this->debug('start'); $result = $this->apcu->$targetMethod($name); diff --git a/src/Legacy/Cache/File.php b/src/Legacy/Cache/File.php index b370e2748..c273620d5 100644 --- a/src/Legacy/Cache/File.php +++ b/src/Legacy/Cache/File.php @@ -119,9 +119,9 @@ class File extends Common public function rm(string $name = null): bool { $targetMethod = is_string($name) ? 'delete' : 'flush'; - $name = is_string($name) ? ("'" . $this->prefix . $name . "'") : null; + $name = is_string($name) ? $this->prefix . $name : null; - $this->cur_query = "cache->$targetMethod($name)"; + $this->cur_query = "cache->$targetMethod('$name')"; $this->debug('start'); $result = $this->file->$targetMethod($name); diff --git a/src/Legacy/Cache/Memcached.php b/src/Legacy/Cache/Memcached.php index bb1ee267e..55aaf35ef 100644 --- a/src/Legacy/Cache/Memcached.php +++ b/src/Legacy/Cache/Memcached.php @@ -174,9 +174,9 @@ class Memcached extends Common } $targetMethod = is_string($name) ? 'delete' : 'flush'; - $name = is_string($name) ? ("'" . $this->prefix . $name . "'") : null; + $name = is_string($name) ? $this->prefix . $name : null; - $this->cur_query = "cache->$targetMethod($name)"; + $this->cur_query = "cache->$targetMethod('$name')"; $this->debug('start'); $result = $this->memcached->$targetMethod($name); diff --git a/src/Legacy/Cache/Redis.php b/src/Legacy/Cache/Redis.php index 2b5b6f45a..cfc819bfd 100644 --- a/src/Legacy/Cache/Redis.php +++ b/src/Legacy/Cache/Redis.php @@ -176,9 +176,9 @@ class Redis extends Common } $targetMethod = is_string($name) ? 'delete' : 'flush'; - $name = is_string($name) ? ("'" . $this->prefix . $name . "'") : null; + $name = is_string($name) ? $this->prefix . $name : null; - $this->cur_query = "cache->$targetMethod($name)"; + $this->cur_query = "cache->$targetMethod('$name')"; $this->debug('start'); $result = $this->redis->$targetMethod($name); diff --git a/src/Legacy/Cache/Sqlite.php b/src/Legacy/Cache/Sqlite.php index 0200c22eb..6d677888b 100644 --- a/src/Legacy/Cache/Sqlite.php +++ b/src/Legacy/Cache/Sqlite.php @@ -117,9 +117,9 @@ class Sqlite extends Common public function rm(string $name = null): bool { $targetMethod = is_string($name) ? 'delete' : 'flush'; - $name = is_string($name) ? ("'" . $this->prefix . $name . "'") : null; + $name = is_string($name) ? $this->prefix . $name : null; - $this->cur_query = "cache->$targetMethod($name)"; + $this->cur_query = "cache->$targetMethod('$name')"; $this->debug('start'); $result = $this->sqlite->$targetMethod($name);