Performs a increment operation on specified numeric cache item
from the given cache configuration.
public static increment ( string $name, string $key, integer $offset = 1, array $options = [] ) : integer | boolean | ||
$name | string | Name of the cache configuration to use. |
$key | string | Key of numeric cache item to increment |
$offset | integer | Offset to increment - defaults to 1. |
$options | array | Options for this method. - `'conditions'`: A function or item that must return or evaluate to `true` in order to continue operation. |
리턴 | integer | boolean | Item's new value on successful increment, false otherwise. |
public function testIncrement() { $config = array('default' => array('adapter' => 'Memory', 'filters' => array())); Cache::config($config); $result = Cache::config(); $expected = $config; $this->assertEqual($expected, $result); $result = Cache::write('default', 'increment', 5, '+1 minute'); $this->assertTrue($result); $result = Cache::increment('default', 'increment'); $this->assertTrue($result); $result = Cache::read('default', 'increment'); $this->assertEqual(6, $result); }