@@ -125,7 +125,7 @@ public function load($key, $fallback = NULL)
125
125
*/
126
126
public function save ($ key , $ data , array $ dependencies = NULL )
127
127
{
128
- $ this ->release () ;
128
+ $ this ->key = $ this -> data = NULL ;
129
129
$ key = $ this ->generateKey ($ key );
130
130
131
131
if ($ data instanceof Nette \Callback || $ data instanceof \Closure) {
@@ -198,7 +198,7 @@ public function remove($key)
198
198
*/
199
199
public function clean (array $ conditions = NULL )
200
200
{
201
- $ this ->release () ;
201
+ $ this ->key = $ this -> data = NULL ;
202
202
$ this ->storage ->clean ((array ) $ conditions );
203
203
}
204
204
@@ -278,6 +278,7 @@ protected function generateKey($key)
278
278
*/
279
279
public function offsetSet ($ key , $ data )
280
280
{
281
+ trigger_error ('Using [] is deprecated; use Cache::save(key, data) instead. ' , E_USER_DEPRECATED );
281
282
$ this ->save ($ key , $ data );
282
283
}
283
284
@@ -287,6 +288,7 @@ public function offsetSet($key, $data)
287
288
*/
288
289
public function offsetGet ($ key )
289
290
{
291
+ trigger_error ('Using [] is deprecated; use Cache::load(key) instead. ' , E_USER_DEPRECATED );
290
292
$ key = is_scalar ($ key ) ? (string ) $ key : serialize ($ key );
291
293
if ($ this ->key !== $ key ) {
292
294
$ this ->key = $ key ;
@@ -301,7 +303,8 @@ public function offsetGet($key)
301
303
*/
302
304
public function offsetExists ($ key )
303
305
{
304
- $ this ->release ();
306
+ trigger_error ('Using [] is deprecated; use Cache::load(key) !== NULL instead. ' , E_USER_DEPRECATED );
307
+ $ this ->key = $ this ->data = NULL ;
305
308
return $ this ->offsetGet ($ key ) !== NULL ;
306
309
}
307
310
@@ -311,6 +314,7 @@ public function offsetExists($key)
311
314
*/
312
315
public function offsetUnset ($ key )
313
316
{
317
+ trigger_error ('Using [] is deprecated; use Cache::remove(key) instead. ' , E_USER_DEPRECATED );
314
318
$ this ->save ($ key , NULL );
315
319
}
316
320
@@ -320,6 +324,7 @@ public function offsetUnset($key)
320
324
*/
321
325
public function release ()
322
326
{
327
+ trigger_error (__METHOD__ . '() is deprecated. ' , E_USER_DEPRECATED );
323
328
$ this ->key = $ this ->data = NULL ;
324
329
}
325
330
0 commit comments