PluginProbe
Parse.ly / 3.8.4
Parse.ly v3.8.4
3.24.1 3.24.0 3.23.7 3.23.6 3.23.5 3.23.4 3.23.3 3.16.0 3.16.1 3.16.2 3.16.3 3.16.4 3.17.0 3.18.0 3.18.1 3.19.0 3.19.1 3.19.2 3.19.3 3.2.0 3.2.1 3.20.0 3.20.1 3.20.2 3.20.3 All 105 releases
← All changes | src/RemoteAPI/class-wordpress-cache.php +7 -22 3.2.03.8.4 View file →
@@ -1,10 +1,10 @@
1 1 <?php
2 2 /**
3 - * Parsely Remote API Adapter for the WordPress Object Cache
3 + * Remote API: Adapter class for the WordPress Object Cache
4 4 *
5 5 * @package Parsely
6 - * @since 3.2.0
6 + * @since 3.2.0
7 7 */
8 8
9 9 declare(strict_types=1);
10 10
@@ -9,31 +9,14 @@
9 9 declare(strict_types=1);
10 10
11 11 namespace Parsely\RemoteAPI;
12 12
13 -use WP_Object_Cache;
14 -
15 13 /**
16 14 * Remote API Adapter for the WordPress Object Cache.
17 15 */
18 16 class WordPress_Cache implements Cache {
19 - /**
20 - * The WordPress Object Cache.
21 - *
22 - * @var WP_Object_Cache
23 - */
24 - private $cache;
25 17
26 18 /**
27 - * Constructor.
28 - *
29 - * @param WP_Object_Cache $cache A class that's compatible with the Cache Interface.
30 - */
31 - public function __construct( WP_Object_Cache $cache ) {
32 - $this->cache = $cache;
33 - }
34 -
35 - /**
36 19 * Retrieves the cache contents from the cache by key and group.
37 20 *
38 21 * @since 3.2.0
39 22 *
@@ -42,12 +25,13 @@
42 25 * @param bool $force Optional. Whether to force an update of the local cache
43 26 * from the persistent cache. Default false.
44 27 * @param bool $found Optional. Whether the key was found in the cache (passed by reference).
45 28 * Disambiguates a return of false, a storable value. Default null.
29 + *
46 30 * @return mixed|false The cache contents on success, false on failure to retrieve contents.
47 31 */
48 32 public function get( $key, string $group = '', bool $force = false, bool $found = null ) {
49 - return $this->cache->get( $key, $group, $force, $found );
33 + return wp_cache_get( $key, $group, $force, $found );
50 34 }
51 35
52 36 /**
53 37 * Saves the data to the cache.
@@ -61,8 +45,9 @@
61 45 * @param int $expire Optional. When to expire the cache contents, in seconds.
62 46 * Default 0 (no expiration).
63 47 * @return bool True on success, false on failure.
64 48 */
65 - public function set( $key, $data, string $group = '', int $expire = 0 ): bool {
66 - return $this->cache->set( $key, $data, $group, $expire );
49 + public function set( $key, $data, string $group = '', $expire = 0 ): bool {
50 + // phpcs:ignore WordPressVIPMinimum.Performance.LowExpiryCacheTime.CacheTimeUndetermined
51 + return wp_cache_set( $key, $data, $group, $expire );
67 52 }
68 53 }