1 | <?php |
||
21 | class Standard |
||
22 | implements \Aimeos\MW\Cache\Iface |
||
23 | { |
||
24 | private $object; |
||
25 | private $context; |
||
26 | |||
27 | |||
28 | /** |
||
29 | * Initializes the cache controller. |
||
30 | * |
||
31 | * @param \Aimeos\MShop\Context\Item\Iface $context MShop context object |
||
32 | */ |
||
33 | public function __construct( \Aimeos\MShop\Context\Item\Iface $context ) |
||
37 | |||
38 | |||
39 | /** |
||
40 | * Removes all expired cache entries. |
||
41 | * |
||
42 | * @throws \Aimeos\MW\Cache\Exception If the cache server doesn't respond |
||
43 | */ |
||
44 | public function cleanup() |
||
48 | |||
49 | |||
50 | /** |
||
51 | * Removes all entries of the site from the cache. |
||
52 | * |
||
53 | * @throws \Aimeos\MW\Cache\Exception If the cache server doesn't respond |
||
54 | */ |
||
55 | public function clear() |
||
56 | { |
||
57 | $this->getObject()->clear(); |
||
58 | } |
||
59 | |||
60 | |||
61 | /** |
||
62 | * Removes the cache entry identified by the given key. |
||
63 | * |
||
64 | * @param string $key Key string that identifies the single cache entry |
||
65 | * @throws \Aimeos\MW\Cache\Exception If the cache server doesn't respond |
||
66 | */ |
||
67 | public function delete( $key ) |
||
68 | { |
||
69 | $this->getObject()->delete( $key ); |
||
70 | } |
||
71 | |||
72 | |||
73 | /** |
||
74 | * Removes the cache entries identified by the given keys. |
||
75 | * |
||
76 | * @param string[] $keys List of key strings that identify the cache entries |
||
77 | * that should be removed |
||
78 | * @throws \Aimeos\MW\Cache\Exception If the cache server doesn't respond |
||
79 | */ |
||
80 | public function deleteMultiple( $keys ) |
||
81 | { |
||
82 | $this->getObject()->deleteMultiple( $keys ); |
||
|
|||
83 | } |
||
84 | |||
85 | |||
86 | /** |
||
87 | * Removes the cache entries identified by the given tags. |
||
88 | * |
||
89 | * @param string[] $tags List of tag strings that are associated to one or more |
||
90 | * cache entries that should be removed |
||
91 | * @throws \Aimeos\MW\Cache\Exception If the cache server doesn't respond |
||
92 | */ |
||
93 | public function deleteByTags( array $tags ) |
||
94 | { |
||
95 | $this->getObject()->deleteByTags( $tags ); |
||
96 | } |
||
97 | |||
98 | |||
99 | /** |
||
100 | * Returns the cached value for the given key. |
||
101 | * |
||
102 | * @param string $key Path to the requested value like product/id/123 |
||
103 | * @param mixed $default Value returned if requested key isn't found |
||
104 | * @return mixed Value associated to the requested key. If no value for the |
||
105 | * key is found in the cache, the given default value is returned |
||
106 | * @throws \Aimeos\MW\Cache\Exception If the cache server doesn't respond |
||
107 | */ |
||
108 | public function get( $key, $default = null ) |
||
112 | |||
113 | |||
114 | /** |
||
115 | * Returns the cached values for the given cache keys if available. |
||
116 | * |
||
117 | * @param string[] $keys List of key strings for the requested cache entries |
||
118 | * @param mixed $default Default value to return for keys that do not exist |
||
119 | * @return array Associative list of key/value pairs for the requested cache |
||
120 | * entries. If a cache entry doesn't exist, neither its key nor a value |
||
121 | * will be in the result list |
||
122 | * @throws \Aimeos\MW\Cache\Exception If the cache server doesn't respond |
||
123 | */ |
||
124 | public function getMultiple( $keys, $default = null ) |
||
128 | |||
129 | |||
130 | /** |
||
131 | * Returns the cached keys and values associated to the given tags if available. |
||
132 | * |
||
133 | * @param string[] $tags List of tag strings associated to the requested cache entries |
||
134 | * @return array Associative list of key/value pairs for the requested cache |
||
135 | * entries. If a tag isn't associated to any cache entry, nothing is returned |
||
136 | * for that tag |
||
137 | * @throws \Aimeos\MW\Cache\Exception If the cache server doesn't respond |
||
138 | */ |
||
139 | public function getMultipleByTags( array $tags ) |
||
143 | |||
144 | |||
145 | /** |
||
146 | * Sets the value for the given key in the cache. |
||
147 | * |
||
148 | * @param string $key Key string for the given value like product/id/123 |
||
149 | * @param string $value Value string that should be stored for the given key |
||
150 | * @param int|string|null $expires Date/time string in "YYYY-MM-DD HH:mm:ss" |
||
151 | * format when the cache entry expires |
||
152 | * @param string[] $tags List of tag strings that should be assoicated to the |
||
153 | * given value in the cache |
||
154 | * @throws \Aimeos\MW\Cache\Exception If the cache server doesn't respond |
||
155 | */ |
||
156 | public function set( $key, $value, $expires = null, array $tags = array() ) |
||
160 | |||
161 | |||
162 | /** |
||
163 | * Adds or overwrites the given key/value pairs in the cache, which is much |
||
164 | * more efficient than setting them one by one using the set() method. |
||
165 | * |
||
166 | * @param array $pairs Associative list of key/value pairs. Both must be |
||
167 | * a string |
||
168 | * @param array $expires Associative list of key/datetime pairs. |
||
169 | * @param string[] $tags Associative list of key/tag or key/tags pairs that should be |
||
170 | * associated to the values identified by their key. The value associated |
||
171 | * to the key can either be a tag string or an array of tag strings |
||
172 | * @throws \Aimeos\MW\Cache\Exception If the cache server doesn't respond |
||
173 | */ |
||
174 | public function setMultiple( $pairs, $expires = null, array $tags = array() ) |
||
178 | |||
179 | |||
180 | /** |
||
181 | * Returns the cache object or creates a new one if it doesn't exist yet. |
||
182 | * |
||
183 | * @return \Aimeos\MW\Cache\Iface Cache object |
||
184 | */ |
||
185 | protected function getObject() |
||
193 | } |
||
194 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: