1 | <?php |
||
20 | abstract class AbstractCacheItemPool implements CacheItemPoolInterface |
||
21 | { |
||
22 | /** |
||
23 | * The options for the cache object. |
||
24 | * |
||
25 | * @var array|\ArrayAccess |
||
26 | * @since 1.0 |
||
27 | */ |
||
28 | protected $options; |
||
29 | |||
30 | /** |
||
31 | * The deferred items to store |
||
32 | * |
||
33 | * @var \Joomla\Cache\Item\Item[] |
||
34 | * @since 1.0 |
||
35 | */ |
||
36 | private $deferred = []; |
||
37 | |||
38 | /** |
||
39 | * Constructor. |
||
40 | * |
||
41 | * @param array|\ArrayAccess $options An options array, or an object that implements \ArrayAccess |
||
42 | * |
||
43 | * @since 1.0 |
||
44 | * @throws \RuntimeException |
||
45 | */ |
||
46 | 81 | public function __construct($options = []) |
|
55 | |||
56 | /** |
||
57 | * Returns a traversable set of cache items. |
||
58 | * |
||
59 | * @param array $keys A list of keys that can obtained in a single operation. |
||
60 | * |
||
61 | * @return CacheItemInterface[] An associative array of CacheItemInterface objects keyed on the cache key. |
||
62 | * |
||
63 | * @since 1.0 |
||
64 | */ |
||
65 | 5 | public function getItems(array $keys = []) |
|
76 | |||
77 | /** |
||
78 | * Get an option from the Cache instance. |
||
79 | * |
||
80 | * @param string $key The name of the option to get. |
||
81 | * |
||
82 | * @return mixed The option value. |
||
83 | * |
||
84 | * @since 1.0 |
||
85 | */ |
||
86 | 14 | public function getOption($key) |
|
90 | |||
91 | /** |
||
92 | * Removes multiple items from the pool. |
||
93 | * |
||
94 | * @param array $keys An array of keys that should be removed from the pool. |
||
95 | * |
||
96 | * @return boolean |
||
97 | * |
||
98 | * @since 1.0 |
||
99 | */ |
||
100 | 7 | public function deleteItems(array $keys) |
|
114 | |||
115 | /** |
||
116 | * Set an option for the Cache instance. |
||
117 | * |
||
118 | * @param string $key The name of the option to set. |
||
119 | * @param mixed $value The option value to set. |
||
120 | * |
||
121 | * @return $this |
||
122 | * |
||
123 | * @since 1.0 |
||
124 | */ |
||
125 | 7 | public function setOption($key, $value) |
|
131 | |||
132 | /** |
||
133 | * Sets a cache item to be persisted later. |
||
134 | * |
||
135 | * @param CacheItemInterface $item The cache item to save. |
||
136 | * |
||
137 | * @return boolean False if the item could not be queued or if a commit was attempted and failed. True otherwise. |
||
138 | * |
||
139 | * @since __DEPLOY_VERSION__ |
||
140 | */ |
||
141 | 7 | public function saveDeferred(CacheItemInterface $item) |
|
147 | |||
148 | /** |
||
149 | * Persists any deferred cache items. |
||
150 | * |
||
151 | * @return boolean True if all not-yet-saved items were successfully saved or there were none. False otherwise. |
||
152 | * |
||
153 | * @since __DEPLOY_VERSION__ |
||
154 | */ |
||
155 | 7 | public function commit() |
|
173 | |||
174 | /** |
||
175 | * Converts a DateTime object from the cache item to the expiry time in seconds from the present |
||
176 | * |
||
177 | * @param HasExpirationDateInterface $item The cache item |
||
178 | * |
||
179 | * @return integer The time in seconds until expiry |
||
180 | * |
||
181 | * @since __DEPLOY_VERSION__ |
||
182 | */ |
||
183 | 3 | protected function convertItemExpiryToSeconds(HasExpirationDateInterface $item) |
|
192 | } |
||
193 |