decrement() public méthode

Performs a decrement operation on a specified numeric cache item.
public decrement ( string $key, integer $offset = 1 ) : integer | boolean
$key string Key of numeric cache item to decrement.
$offset integer Offset to decrement - defaults to `1`.
Résultat integer | boolean The item's new value on successful decrement, else `false`.
Exemple #1
0
 public function testDecrementWithScope()
 {
     $adapter = new File(array('scope' => 'primary'));
     $this->File->write(array('primary_key1' => 5));
     $this->File->write(array('key1' => 10));
     $expected = 4;
     $result = $adapter->decrement('key1');
     $this->assertEqual($expected, $result);
     $expected = array('key1' => 4);
     $result = $adapter->read(array('key1'));
     $this->assertEqual($expected, $result);
 }