1 | <?php |
||
32 | abstract class AbstractStorage implements StorageInterface |
||
33 | { |
||
34 | |||
35 | /** |
||
36 | * Register the trait that provides basic storage functionality. |
||
37 | * |
||
38 | * @var \Trait |
||
39 | */ |
||
40 | use StorageTrait; |
||
41 | |||
42 | /** |
||
43 | * A storage backend, a \Stackable for example. |
||
44 | * |
||
45 | * @var mixed |
||
46 | */ |
||
47 | protected $storage; |
||
48 | |||
49 | /** |
||
50 | * Passes the configuration and initializes the storage. |
||
51 | */ |
||
52 | public function __construct() |
||
57 | |||
58 | /** |
||
59 | * Restores the storage after the instance has been recovered |
||
60 | * from sleep. |
||
61 | * |
||
62 | * @return void |
||
63 | */ |
||
64 | public function __wakeup() |
||
68 | |||
69 | /** |
||
70 | * Initializes the storage when the instance is constructed and the |
||
71 | * __wakeup() method is invoked. |
||
72 | * |
||
73 | * @return void |
||
74 | */ |
||
75 | abstract public function init(); |
||
76 | |||
77 | /** |
||
78 | * (non-PHPdoc) |
||
79 | * |
||
80 | * @return void |
||
81 | * @see \AppserverIo\Storage\StorageInterface::collectGarbage() |
||
82 | */ |
||
83 | public function collectGarbage() |
||
87 | |||
88 | /** |
||
89 | * (non-PHPdoc) |
||
90 | * |
||
91 | * @param string $tag The tag to search for |
||
92 | * |
||
93 | * @return array An array with the identifier (key) and content (value) of all matching entries. An empty array if no entries matched |
||
94 | * @see \AppserverIo\Storage\StorageInterface::getByTag() |
||
95 | */ |
||
96 | public function getByTag($tag) |
||
100 | |||
101 | /** |
||
102 | * (non-PHPdoc) |
||
103 | * |
||
104 | * @param string $entryIdentifier An identifier specifying the cache entry |
||
105 | * |
||
106 | * @return boolean TRUE if such an entry exists, FALSE if not |
||
107 | * @see \AppserverIo\Storage\StorageInterface::has() |
||
108 | */ |
||
109 | public function has($entryIdentifier) |
||
116 | |||
117 | /** |
||
118 | * Injects the storage instance to use. |
||
119 | * |
||
120 | * @param mixed $storage The storge instance to use |
||
121 | * |
||
122 | * @return void |
||
123 | */ |
||
124 | public function injectStorage($storage) |
||
128 | |||
129 | /** |
||
130 | * (non-PHPdoc) |
||
131 | * |
||
132 | * @return mixed The storage object itself |
||
133 | * @see \AppserverIo\Storage\StorageInterface::getStorage() |
||
134 | */ |
||
135 | public function getStorage() |
||
139 | } |
||
140 |