run:R W Run
1.83 KB
2026-03-11 16:18:52
R W Run
3.5 KB
2026-03-11 16:18:52
R W Run
1.48 KB
2026-03-11 16:18:52
R W Run
3.62 KB
2026-03-11 16:18:52
R W Run
2.73 KB
2026-03-11 16:18:52
R W Run
2.91 KB
2026-03-11 16:18:52
R W Run
3.63 KB
2026-03-11 16:18:52
R W Run
3.74 KB
2026-03-11 16:18:52
R W Run
13.38 KB
2026-03-11 16:18:52
R W Run
1.15 KB
2026-03-11 16:18:52
R W Run
3.18 KB
2026-03-11 16:18:52
R W Run
4.2 KB
2026-03-11 16:18:52
R W Run
error_log
📄Psr16.php
1<?php
2
3// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
4// SPDX-License-Identifier: BSD-3-Clause
5
6declare(strict_types=1);
7
8namespace SimplePie\Cache;
9
10use Psr\SimpleCache\CacheInterface;
11use Psr\SimpleCache\InvalidArgumentException;
12use Throwable;
13
14/**
15 * Caches data into a PSR-16 cache implementation
16 *
17 * @internal
18 */
19final class Psr16 implements DataCache
20{
21 /**
22 * PSR-16 cache implementation
23 *
24 * @var CacheInterface
25 */
26 private $cache;
27
28 /**
29 * PSR-16 cache implementation
30 *
31 * @param CacheInterface $cache
32 */
33 public function __construct(CacheInterface $cache)
34 {
35 $this->cache = $cache;
36 }
37
38 /**
39 * Fetches a value from the cache.
40 *
41 * Equivalent to \Psr\SimpleCache\CacheInterface::get()
42 * <code>
43 * public function get(string $key, mixed $default = null): mixed;
44 * </code>
45 *
46 * @param string $key The unique key of this item in the cache.
47 * @param mixed $default Default value to return if the key does not exist.
48 *
49 * @return array|mixed The value of the item from the cache, or $default in case of cache miss.
50 *
51 * @throws InvalidArgumentException&Throwable
52 * MUST be thrown if the $key string is not a legal value.
53 */
54 public function get_data(string $key, $default = null)
55 {
56 $data = $this->cache->get($key, $default);
57
58 if (!is_array($data) || $data === $default) {
59 return $default;
60 }
61
62 return $data;
63 }
64
65 /**
66 * Persists data in the cache, uniquely referenced by a key with an optional expiration TTL time.
67 *
68 * Equivalent to \Psr\SimpleCache\CacheInterface::set()
69 * <code>
70 * public function set(string $key, mixed $value, null|int|\DateInterval $ttl = null): bool;
71 * </code>
72 *
73 * @param string $key The key of the item to store.
74 * @param array<mixed> $value The value of the item to store, must be serializable.
75 * @param null|int $ttl Optional. The TTL value of this item. If no value is sent and
76 * the driver supports TTL then the library may set a default value
77 * for it or let the driver take care of that.
78 *
79 * @return bool True on success and false on failure.
80 *
81 * @throws InvalidArgumentException&Throwable
82 * MUST be thrown if the $key string is not a legal value.
83 */
84 public function set_data(string $key, array $value, ?int $ttl = null): bool
85 {
86 return $this->cache->set($key, $value, $ttl);
87 }
88
89 /**
90 * Delete an item from the cache by its unique key.
91 *
92 * Equivalent to \Psr\SimpleCache\CacheInterface::delete()
93 * <code>
94 * public function delete(string $key): bool;
95 * </code>
96 *
97 * @param string $key The unique cache key of the item to delete.
98 *
99 * @return bool True if the item was successfully removed. False if there was an error.
100 *
101 * @throws InvalidArgumentException&Throwable
102 * MUST be thrown if the $key string is not a legal value.
103 */
104 public function delete_data(string $key): bool
105 {
106 return $this->cache->delete($key);
107 }
108}
109