Property | Type | Description | |
---|---|---|---|
$client | PDO | ||
$table | string |
Method | Description | |
---|---|---|
__construct ( PDO $client, string $table = 'cache' ) | ||
add ( $key, $value, $expire ) | ||
cas ( $token, $key, $value, $expire ) | ||
decrement ( $key, $offset = 1, $initial, $expire ) | ||
delete ( $key ) | ||
deleteMulti ( array $keys ) | ||
flush ( ) | ||
get ( $key, &$token = null ) | ||
getMulti ( array $keys, array &$tokens = null ) | ||
increment ( $key, $offset = 1, $initial, $expire ) | ||
replace ( $key, $value, $expire ) | ||
set ( $key, $value, $expire ) | ||
setMulti ( array $items, $expire ) | ||
touch ( $key, $expire ) |
Method | Description | |
---|---|---|
clearExpired ( ) | Expired entries shouldn't keep filling up the database. Additionally, we will want to remove those in order to properly rely on INSERT (for add) and UPDATE (for replace), which assume a column exists or not, not taking the expiration status into consideration. | |
doIncrement ( string $key, integer $offset, integer $initial, integer $expire ) : integer | boolean | Shared between increment/decrement: both have mostly the same logic (decrement just increments a negative value), but need their validation & use of non-ttl native methods split up. | |
expire ( integer $expire ) : null | string | Transforms expiration times into TIMESTAMP (Y-m-d H:i:s) format, which DB will understand and be able to compare with other dates. | |
init ( ) | Create the database/indices if it does not already exist. | |
serialize ( mixed $value ) : string | integer | I originally didn't want to serialize numeric values because I planned on incrementing them in the DB, but revisited that idea. | |
unserialize ( mixed $value ) : mixed | integer | float | Numbers aren't serialized for storage size purposes. |
public __construct ( PDO $client, string $table = 'cache' ) | ||
$client | PDO | |
$table | string |
protected clearExpired ( ) |
abstract protected init ( ) |