PluginProbe
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin / 1.1.9
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin v1.1.9
1.1.9 1.1.8 1.1.7 1.1.6 1.1.5 1.1.4 1.1.3 1.1.2 1.1.1 1.1.0 1.0.1 1.0.0 0.9.8 0.9.7 0.9.6 0.9.4 0.9.5 0.9.3 0.9.2 0.9.1 0.9.0 0.8.9 0.8.8 0.8.7 0.8.6 All 33 releases
desktop-mode / includes / framework / app / wordpress / class-cache.php

class-cache.php in OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin 1.1.9, at includes/framework/app/wordpress/class-cache.php

42 lines 991 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * OpenStation App Framework — WordPress Cache adapter.
4 *
5 * Backed by the object cache under one group. Without a persistent
6 * object cache drop-in this only lives for the request, which is
7 * exactly the contract: a miss is always safe.
8 *
9 * @package OpenStation
10 */
11
12 namespace OpenStation\App\WordPress;
13
14 use OpenStation\App\Contracts\Cache as CacheContract;
15
16 defined( 'ABSPATH' ) || exit;
17
18 /**
19 * Object-cache backed cache.
20 */
21 final class Cache implements CacheContract {
22
23 const GROUP = 'openstation_apps';
24
25 /** {@inheritDoc} */
26 public function get( $key, $fallback = null ) {
27 $found = false;
28 $value = wp_cache_get( (string) $key, self::GROUP, false, $found );
29 return $found ? $value : $fallback;
30 }
31
32 /** {@inheritDoc} */
33 public function set( $key, $value, $ttl = 0 ) {
34 wp_cache_set( (string) $key, $value, self::GROUP, max( 0, (int) $ttl ) );
35 }
36
37 /** {@inheritDoc} */
38 public function delete( $key ) {
39 wp_cache_delete( (string) $key, self::GROUP );
40 }
41 }
42