PluginProbe
Auto Alt Text / trunk
Auto Alt Text vtrunk
3.0.3 2.8.2 1.3.1 1.3.2 2.0.0 2.1.0 2.1.1 2.2.0 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 2.4.0 2.4.1 2.4.2 2.5.0 2.5.1 2.5.2 2.5.3 2.6.0 2.6.1 2.7.0 2.8.0 2.8.1 All 28 releases
auto-alt-text / src / App / Infrastructure / Cache / WordPressTransientCache.php

WordPressTransientCache.php in Auto Alt Text trunk, at src/App/Infrastructure/Cache/WordPressTransientCache.php

28 lines 552 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 namespace AATXT\App\Infrastructure\Cache;
6
7 /**
8 * Cache implementation backed by the WordPress Transients API.
9 */
10 class WordPressTransientCache implements CacheInterface
11 {
12 public function get(string $key)
13 {
14 $value = get_transient($key);
15 return $value === false ? null : $value;
16 }
17
18 public function set(string $key, $value, int $ttl): void
19 {
20 set_transient($key, $value, $ttl);
21 }
22
23 public function delete(string $key): void
24 {
25 delete_transient($key);
26 }
27 }
28