PluginProbe
User Access Manager / 2.3.13
User Access Manager v2.3.13
2.3.20 2.3.19 2.3.18 2.3.17 2.3.16 2.3.15 2.3.14 2.3.13 trunk 0.6 0.6.1 0.6.2 0.7 0.7 Beta 0.7.0.1 0.8 0.8.0.1 0.8.0.2 0.9 0.9.1 0.9.1.1 0.9.1.2 0.9.1.3 0.9.1.4 1.0 All 136 releases
← All changes | src/Cache/RedisCacheProvider.php +10 -12 trunk2.3.13 View file →
@@ -6,24 +6,22 @@
6 6
7 7 use Exception;
8 8 use UserAccessManager\Config\Config;
9 9 use UserAccessManager\Config\ConfigFactory;
10 -use UserAccessManager\Config\Parameter\ConfigParameterFactory;
11 -use UserAccessManager\Wrapper\Wordpress;
10 +use UserAccessManager\Config\ConfigParameterFactory;
12 11
13 12 class RedisCacheProvider implements CacheProviderInterface
14 13 {
15 - public const ID = 'RedisCacheProvider';
16 - public const CONFIG_KEY = 'uam_redis_cache_provider';
17 - public const CONFIG_PREFIX = 'redis_prefix';
18 - public const CONFIG_TTL = 'redis_ttl';
19 - public const DEFAULT_PREFIX = 'uam_cache';
20 - public const DEFAULT_TTL = 0;
14 + const ID = 'RedisCacheProvider';
15 + const CONFIG_KEY = 'uam_redis_cache_provider';
16 + const CONFIG_PREFIX = 'redis_prefix';
17 + const CONFIG_TTL = 'redis_ttl';
18 + const DEFAULT_PREFIX = 'uam_cache';
19 + const DEFAULT_TTL = 0;
21 20
22 21 private ?Config $config = null;
23 22
24 23 public function __construct(
25 - private Wordpress $wordpress,
26 24 private ConfigFactory $configFactory,
27 25 private ConfigParameterFactory $configParameterFactory
28 26 ) {
29 27 }
@@ -79,14 +77,14 @@
79 77 }
80 78
81 79 public function add(string $key, mixed $value): void
82 80 {
83 - $this->wordpress->wpCacheSet($this->buildKey($key), $value, self::ID, $this->getTtl());
81 + wp_cache_set($this->buildKey($key), $value, self::ID, $this->getTtl());
84 82 }
85 83
86 84 public function get(string $key): mixed
87 85 {
88 - $value = $this->wordpress->wpCacheGet($this->buildKey($key), self::ID);
86 + $value = wp_cache_get($this->buildKey($key), self::ID);
89 87
90 88 // wp_cache_get returns false on a miss; normalize to null per interface contract.
91 89 return ($value === false) ? null : $value;
92 90 }
@@ -92,7 +90,7 @@
92 90 }
93 91
94 92 public function invalidate(string $key): void
95 93 {
96 - $this->wordpress->wpCacheDelete($this->buildKey($key), self::ID);
94 + wp_cache_delete($this->buildKey($key), self::ID);
97 95 }
98 96 }