1 | <?php |
||
49 | class CachePool extends EventableExtensionCapableAbstract implements CacheItemPoolInterface, DriverAwareInterface, FallbackAwareInterface, UtilityAwareInterface, ErrorAwareInterface |
||
50 | { |
||
51 | use DriverAwareTrait, CacheItemAwareTrait, UtilityAwareTrait, FallbackAwareTrait, ErrorAwareTrait; |
||
52 | |||
53 | /** |
||
54 | * event names |
||
55 | * @var string |
||
56 | */ |
||
57 | const EVENT_HAS_BEFORE = 'cache.has.before'; |
||
58 | const EVENT_HAS_AFTER = 'cache.has.after'; |
||
59 | const EVENT_GET_BEFORE = 'cache.get.before'; |
||
60 | const EVENT_GET_AFTER = 'cache.get.after'; |
||
61 | const EVENT_SET_BEFORE = 'cache.set.before'; |
||
62 | const EVENT_SET_AFTER = 'cache.set.after'; |
||
63 | const EVENT_CLEAR_BEFORE = 'cache.clear.before'; |
||
64 | const EVENT_CLEAR_AFTER = 'cache.clear.after'; |
||
65 | const EVENT_DELETE_BEFORE = 'cache.delete.before'; |
||
66 | const EVENT_DELETE_AFTER = 'cache.delete.after'; |
||
67 | const EVENT_SAVE_BEFORE = 'cache.save.before'; |
||
68 | const EVENT_SAVE_AFTER = 'cache.save.after'; |
||
69 | const EVENT_DEFER_BEFORE = 'cache.defer.before'; |
||
70 | const EVENT_DEFER_AFTER = 'cache.defer.after'; |
||
71 | const EVENT_COMMIT_BEFORE = 'cache.commit.before'; |
||
72 | const EVENT_COMMIT_AFTER = 'cache.commit.after'; |
||
73 | |||
74 | /** |
||
75 | * Constructor |
||
76 | * |
||
77 | * @param DriverInterface $driver |
||
78 | * @access public |
||
79 | * @since 2.0.1 removed eventManager param |
||
80 | */ |
||
81 | public function __construct(DriverInterface $driver = null) |
||
92 | |||
93 | /** |
||
94 | * Destructor |
||
95 | * |
||
96 | * @access public |
||
97 | */ |
||
98 | public function __destruct() |
||
102 | |||
103 | /** |
||
104 | * {@inheritDoc} |
||
105 | */ |
||
106 | public function getItem($key) |
||
110 | |||
111 | /** |
||
112 | * {@inheritDoc} |
||
113 | */ |
||
114 | public function getItems(array $keys = array()) |
||
122 | |||
123 | /** |
||
124 | * {@inheritDoc} |
||
125 | */ |
||
126 | public function hasItem($key) |
||
130 | |||
131 | /** |
||
132 | * {@inheritDoc} |
||
133 | */ |
||
134 | public function clear() |
||
142 | |||
143 | /** |
||
144 | * {@inheritDoc} |
||
145 | */ |
||
146 | public function deleteItem($key) |
||
156 | |||
157 | /** |
||
158 | * {@inheritDoc} |
||
159 | */ |
||
160 | public function deleteItems(array $keys) |
||
169 | |||
170 | /** |
||
171 | * {@inheritDoc} |
||
172 | */ |
||
173 | public function save(CacheItemInterface $item) |
||
182 | |||
183 | /** |
||
184 | * {@inheritDoc} |
||
185 | */ |
||
186 | public function saveDeferred(CacheItemInterface $item) |
||
195 | |||
196 | /** |
||
197 | * {@inheritDoc} |
||
198 | */ |
||
199 | public function commit() |
||
207 | |||
208 | /** |
||
209 | * Execute an action |
||
210 | * |
||
211 | * @param string $action |
||
212 | * @param string $beforeEvent |
||
213 | * @param string $afterEvent |
||
214 | * @param CacheItemInterface $item |
||
215 | * @return bool |
||
216 | * @access protected |
||
217 | */ |
||
218 | protected function eventableAction( |
||
237 | |||
238 | /** |
||
239 | * Execute an action with the driver |
||
240 | * |
||
241 | * @param string $action |
||
242 | * @param CacheItemInterface|null $item |
||
243 | * @access protected |
||
244 | */ |
||
245 | protected function driverAction(/*# string */ $action, $item)/*# : bool */ |
||
253 | } |
||
254 |