12
12
use DateInterval ;
13
13
use Phalcon \Cache \Adapter \AdapterInterface ;
14
14
use Phalcon \Cache \Exception \InvalidArgumentException ;
15
+ use Phalcon \Events \EventsAwareInterface ;
16
+ use Phalcon \Events \ManagerInterface ;
15
17
use Traversable ;
16
18
17
19
/**
18
20
* This component offers caching capabilities for your application.
19
21
*/
20
- abstract class AbstractCache implements \Phalcon \Cache \CacheInterface
22
+ abstract class AbstractCache implements \Phalcon \Cache \CacheInterface, \ Phalcon \ Events \EventsAwareInterface
21
23
{
22
24
/**
23
25
* The adapter
@@ -26,6 +28,13 @@ abstract class AbstractCache implements \Phalcon\Cache\CacheInterface
26
28
*/
27
29
protected $ adapter ;
28
30
31
+ /**
32
+ * Event Manager
33
+ *
34
+ * @var ManagerInterface|null
35
+ */
36
+ protected $ eventsManager = null ;
37
+
29
38
/**
30
39
* Constructor.
31
40
*
@@ -44,6 +53,25 @@ public function getAdapter(): AdapterInterface
44
53
{
45
54
}
46
55
56
+ /**
57
+ * Sets the event manager
58
+ *
59
+ * @param \Phalcon\Events\ManagerInterface $eventsManager
60
+ * @return void
61
+ */
62
+ public function setEventsManager (\Phalcon \Events \ManagerInterface $ eventsManager ): void
63
+ {
64
+ }
65
+
66
+ /**
67
+ * Get the event manager
68
+ *
69
+ * @return ManagerInterface|null
70
+ */
71
+ public function getEventsManager (): ?ManagerInterface
72
+ {
73
+ }
74
+
47
75
/**
48
76
* Checks the key. If it contains invalid characters an exception is thrown
49
77
*
@@ -114,7 +142,7 @@ protected function doDeleteMultiple($keys): bool
114
142
* @throws InvalidArgumentException MUST be thrown if the $key string is
115
143
* not a legal value.
116
144
*/
117
- protected function doGet (string $ key , $ defaultValue = null ): mixed
145
+ protected function doGet (string $ key , $ defaultValue = null )
118
146
{
119
147
}
120
148
@@ -176,6 +204,17 @@ protected function doSetMultiple($values, $ttl = null): bool
176
204
{
177
205
}
178
206
207
+ /**
208
+ * Trigger an event for the eventsManager.
209
+ *
210
+ * @param string $eventName
211
+ * @param mixed $keys
212
+ * @return void
213
+ */
214
+ protected function fire (string $ eventName , $ keys ): void
215
+ {
216
+ }
217
+
179
218
/**
180
219
* Returns the exception class that will be used for exceptions thrown
181
220
*
0 commit comments