Skip to content

Commit 015cc6b

Browse files
committed
Cache: removed ArrayAccess strongly deprecated in 2.3
1 parent 2885ee2 commit 015cc6b

File tree

1 file changed

+1
-68
lines changed

1 file changed

+1
-68
lines changed

src/Caching/Cache.php

Lines changed: 1 addition & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* @property-read IStorage $storage
1818
* @property-read string $namespace
1919
*/
20-
class Cache extends Nette\Object implements \ArrayAccess
20+
class Cache extends Nette\Object
2121
{
2222
/** dependency */
2323
const PRIORITY = 'priority',
@@ -40,12 +40,6 @@ class Cache extends Nette\Object implements \ArrayAccess
4040
/** @var string */
4141
private $namespace;
4242

43-
/** @var string last query cache used by offsetGet() */
44-
private $key;
45-
46-
/** @var mixed last query cache used by offsetGet() */
47-
private $data;
48-
4943

5044
public function __construct(IStorage $storage, $namespace = NULL)
5145
{
@@ -123,7 +117,6 @@ public function load($key, $fallback = NULL)
123117
*/
124118
public function save($key, $data, array $dependencies = NULL)
125119
{
126-
$this->key = $this->data = NULL;
127120
$key = $this->generateKey($key);
128121

129122
if ($data instanceof Nette\Callback || $data instanceof \Closure) {
@@ -196,7 +189,6 @@ public function remove($key)
196189
*/
197190
public function clean(array $conditions = NULL)
198191
{
199-
$this->key = $this->data = NULL;
200192
$this->storage->clean((array) $conditions);
201193
}
202194

@@ -268,65 +260,6 @@ protected function generateKey($key)
268260
}
269261

270262

271-
/********************* interface ArrayAccess ****************d*g**/
272-
273-
274-
/**
275-
* @deprecated
276-
*/
277-
public function offsetSet($key, $data)
278-
{
279-
trigger_error('Using [] is deprecated; use Cache::save(key, data) instead.', E_USER_DEPRECATED);
280-
$this->save($key, $data);
281-
}
282-
283-
284-
/**
285-
* @deprecated
286-
*/
287-
public function offsetGet($key)
288-
{
289-
trigger_error('Using [] is deprecated; use Cache::load(key) instead.', E_USER_DEPRECATED);
290-
$key = is_scalar($key) ? (string) $key : serialize($key);
291-
if ($this->key !== $key) {
292-
$this->key = $key;
293-
$this->data = $this->load($key);
294-
}
295-
return $this->data;
296-
}
297-
298-
299-
/**
300-
* @deprecated
301-
*/
302-
public function offsetExists($key)
303-
{
304-
trigger_error('Using [] is deprecated; use Cache::load(key) !== NULL instead.', E_USER_DEPRECATED);
305-
$this->key = $this->data = NULL;
306-
return $this->offsetGet($key) !== NULL;
307-
}
308-
309-
310-
/**
311-
* @deprecated
312-
*/
313-
public function offsetUnset($key)
314-
{
315-
trigger_error('Using [] is deprecated; use Cache::remove(key) instead.', E_USER_DEPRECATED);
316-
$this->save($key, NULL);
317-
}
318-
319-
320-
/**
321-
* @deprecated
322-
*/
323-
public function release()
324-
{
325-
trigger_error(__METHOD__ . '() is deprecated.', E_USER_DEPRECATED);
326-
$this->key = $this->data = NULL;
327-
}
328-
329-
330263
/********************* dependency checkers ****************d*g**/
331264

332265

0 commit comments

Comments
 (0)