@@ -125,7 +125,7 @@ public function load($key, $fallback = NULL)
125125 */
126126 public function save ($ key , $ data , array $ dependencies = NULL )
127127 {
128- $ this ->release () ;
128+ $ this ->key = $ this -> data = NULL ;
129129 $ key = $ this ->generateKey ($ key );
130130
131131 if ($ data instanceof Nette \Callback || $ data instanceof \Closure) {
@@ -198,7 +198,7 @@ public function remove($key)
198198 */
199199 public function clean (array $ conditions = NULL )
200200 {
201- $ this ->release () ;
201+ $ this ->key = $ this -> data = NULL ;
202202 $ this ->storage ->clean ((array ) $ conditions );
203203 }
204204
@@ -278,6 +278,7 @@ protected function generateKey($key)
278278 */
279279 public function offsetSet ($ key , $ data )
280280 {
281+ trigger_error ('Using [] is deprecated; use Cache::save(key, data) instead. ' , E_USER_DEPRECATED );
281282 $ this ->save ($ key , $ data );
282283 }
283284
@@ -287,6 +288,7 @@ public function offsetSet($key, $data)
287288 */
288289 public function offsetGet ($ key )
289290 {
291+ trigger_error ('Using [] is deprecated; use Cache::load(key) instead. ' , E_USER_DEPRECATED );
290292 $ key = is_scalar ($ key ) ? (string ) $ key : serialize ($ key );
291293 if ($ this ->key !== $ key ) {
292294 $ this ->key = $ key ;
@@ -301,7 +303,8 @@ public function offsetGet($key)
301303 */
302304 public function offsetExists ($ key )
303305 {
304- $ this ->release ();
306+ trigger_error ('Using [] is deprecated; use Cache::load(key) !== NULL instead. ' , E_USER_DEPRECATED );
307+ $ this ->key = $ this ->data = NULL ;
305308 return $ this ->offsetGet ($ key ) !== NULL ;
306309 }
307310
@@ -311,6 +314,7 @@ public function offsetExists($key)
311314 */
312315 public function offsetUnset ($ key )
313316 {
317+ trigger_error ('Using [] is deprecated; use Cache::remove(key) instead. ' , E_USER_DEPRECATED );
314318 $ this ->save ($ key , NULL );
315319 }
316320
@@ -320,6 +324,7 @@ public function offsetUnset($key)
320324 */
321325 public function release ()
322326 {
327+ trigger_error (__METHOD__ . '() is deprecated. ' , E_USER_DEPRECATED );
323328 $ this ->key = $ this ->data = NULL ;
324329 }
325330
0 commit comments