PluginProbe
WooCommerce / 11.1.0-beta.1
WooCommerce v11.1.0-beta.1
11.1.0 11.1.0-rc.2 11.1.0-rc.1 11.1.0-beta.2 11.1.0-beta.1 11.0.1 11.0.0 11.0.0-rc.3 11.0.0-rc.2 11.0.0-rc.1 11.0.0-beta.2 11.0.0-beta.1 10.9.4 10.9.3 10.9.2 10.9.1 10.9.0 10.9.0-rc.1 10.9.0-beta.2 10.9.0-beta.1 10.8.1 10.8.0 10.8.0-rc.1 10.8.0-beta.2 10.8.0-beta.1 All 648 releases
woocommerce / src / Caching / CacheEngine.php
CacheEngine.php
62 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Automattic\WooCommerce\Caching;
4
5 /**
6 * Interface for cache engines used by objects inheriting from ObjectCache.
7 * Here "object" means either an array or an actual PHP object.
8 */
9 interface CacheEngine {
10
11 /**
12 * Retrieves an object cached under a given key.
13 *
14 * @param string $key They key under which the object to retrieve is cached.
15 * @param string $group The group under which the object is cached.
16 *
17 * @return array|object|null The cached object, or null if there's no object cached under the passed key.
18 */
19 public function get_cached_object( string $key, string $group = '' );
20
21 /**
22 * Caches an object under a given key, and with a given expiration.
23 *
24 * @param string $key The key under which the object will be cached.
25 * @param array|object $object The object to cache.
26 * @param int $expiration Expiration for the cached object, in seconds.
27 * @param string $group The group under which the object will be cached.
28 *
29 * @return bool True if the object is cached successfully, false otherwise.
30 */
31 public function cache_object( string $key, $object, int $expiration, string $group = '' ): bool;
32
33 /**
34 * Removes a cached object from the cache.
35 *
36 * @param string $key They key under which the object is cached.
37 * @param string $group The group under which the object is cached.
38 *
39 * @return bool True if the object is removed from the cache successfully, false otherwise (because the object wasn't cached or for other reason).
40 */
41 public function delete_cached_object( string $key, string $group = '' ): bool;
42
43 /**
44 * Checks if an object is cached under a given key.
45 *
46 * @param string $key The key to verify.
47 * @param string $group The group under which the object is cached.
48 *
49 * @return bool True if there's an object cached under the given key, false otherwise.
50 */
51 public function is_cached( string $key, string $group = '' ): bool;
52
53 /**
54 * Deletes all cached objects under a given group.
55 *
56 * @param string $group The group to delete.
57 *
58 * @return bool True if the group is deleted successfully, false otherwise.
59 */
60 public function delete_cache_group( string $group = '' ): bool;
61 }
62