K2hdkc::casIncrement
Increments a value using CAS operation
Description
public function casIncrement(
string $key,
string $password = null,
int $expiration_duration = 0): bool {}
Increments a value using CAS operation.
Parameters
- key
Specify the key. - password
Specify the passphrase for encrypting the value. - expiration_duration
Specify the expiration duration in seconds.
Return Values
Returns true
on success, otherwise false
.
Examples
- Example 1 - Increments a value using CAS operation
php -r '
$handle = new K2hdkc("./tests/slave.ini");
$handle->casInit("key", 0);
$handle->casIncrement("key");
var_dump($handle->casGet("key"));
$handle->close();
'
The above example will output:
int(1)
See Also
- K2hdkc::casInit - Initializes a value using CAS operation
- K2hdkc::casGet - Gets a value using CAS operation