Свойство | Тип | Описание | |
---|---|---|---|
$cache | MatthiasMullie\Scrapbook\KeyValueStore | Cache to write to. | |
$flush | boolean | Flush is special - it's not specific to (a) key(s), so we can't store it to $keys. | |
$keys | array[] | E.g. 2 sets, the later will override the former. E.g. set + increment, might as well set incremented value immediately. This is going to be an array that holds horrible arrays of update data, being: * 0: the operation name (set, add, ...) so we're able to sort them * 1: a callable, to apply the update to cache * 2: the array of data to supply to the callable |
Метод | Описание | |
---|---|---|
__construct ( MatthiasMullie\Scrapbook\KeyValueStore $cache ) | ||
__destruct ( ) | ||
add ( string $key, mixed $value, integer $expire ) | ||
cas ( mixed $originalValue, string $key, mixed $value, integer $expire ) | ||
clear ( ) | Clears all scheduled writes. | |
commit ( ) : boolean | Commit all deferred writes to cache. | |
decrement ( string $key, integer $offset, integer $initial, integer $expire ) | ||
delete ( string $key ) | ||
deleteMulti ( array $keys ) | ||
flush ( ) | ||
increment ( string $key, integer $offset, integer $initial, integer $expire ) | ||
replace ( string $key, mixed $value, integer $expire ) | ||
set ( string $key, mixed $value, integer $expire ) | ||
setMulti ( array $items, integer $expire ) | ||
touch ( string $key, integer $expire ) |
Метод | Описание | |
---|---|---|
combineUpdates ( array $updates ) : array | We may have multiple sets & deletes, which can be combined into a single setMulti or deleteMulti operation. | |
doIncrement ( string $operation, string $key, integer $offset, integer $initial, integer $expire ) | ||
generateRollback ( ) : array[] | Since we can't perform true atomic transactions, we'll fake it. | |
generateUpdates ( ) : array | By storing all updates by key, we've already made sure we don't perform redundant operations on a per-key basis. Now we'll turn those into actual updates. | |
rollback ( array $old, array $new ) | Roll the cache back to pre-transaction state by comparing the current cache values with what we planned to set them to. | |
sortUpdates ( array $a, array $b ) : integer | Change the order of the updates in this transaction to ensure we have those most likely to fail first. That'll decrease odds of having to roll back, and make rolling back easier. |
public __construct ( MatthiasMullie\Scrapbook\KeyValueStore $cache ) | ||
$cache | MatthiasMullie\Scrapbook\KeyValueStore |
protected combineUpdates ( array $updates ) : array | ||
$updates | array | |
Результат | array |
protected generateRollback ( ) : array[] | ||
Результат | array[] | Array of 2 [key => value] maps: current & scheduled data |
protected generateUpdates ( ) : array | ||
Результат | array |
protected KeyValueStore,MatthiasMullie\Scrapbook $cache | ||
Результат | MatthiasMullie\Scrapbook\KeyValueStore |
protected bool $flush | ||
Результат | boolean |
protected array[] $keys | ||
Результат | array[] |