DatabaseStore
Implements
Uses
Properties
$lockConnection ConnectionInterface
The database connection instance that should be used to manage locks.
$table string
The name of the cache table.
$prefix string
A string that should be prepended to keys.
$lockTable string
The name of the cache locks table.
$lockLottery array
An array representation of the lock lottery odds.
$defaultLockTimeoutInSeconds int
The default number of seconds that a lock should be held.
Methods
__construct ( ConnectionInterface $connection , $table , $prefix , $lockTable , $lockLottery , $defaultLockTimeoutInSeconds ) : void
Create a new database store.
Parameters
- $connection ConnectionInterface
- $table string
- $prefix string
- $lockTable string
- $lockLottery array
get ( $key ) : mixed
Retrieve an item from the cache by key.
Parameters
- $key string|array
put ( $key , $value , $seconds ) : bool
Store an item in the cache for a given number of seconds.
Parameters
- $key string
- $value mixed
- $seconds int
add ( $key , $value , $seconds ) : bool
Store an item in the cache if the key doesn't exist.
Parameters
- $key string
- $value mixed
- $seconds int
increment ( $key , $value ) : int|bool
Increment the value of an item in the cache.
Parameters
- $key string
- $value mixed
decrement ( $key , $value ) : int|bool
Decrement the value of an item in the cache.
Parameters
- $key string
- $value mixed
incrementOrDecrement ( $key , $value , Closure $callback ) : int|bool
Increment or decrement an item in the cache.
Parameters
- $key string
- $value mixed
- $callback Closure
getTime ( ) : int
Get the current system time.
forever ( $key , $value ) : bool
Store an item in the cache indefinitely.
Parameters
- $key string
- $value mixed
lock ( $name , $seconds , $owner ) : Lock
Get a lock instance.
Parameters
- $name string
- $seconds int
- $owner string|null
restoreLock ( $name , $owner ) : Lock
Restore a lock instance using the owner identifier.
Parameters
- $name string
- $owner string
forget ( $key ) : bool
Remove an item from the cache.
Parameters
- $key string
flush ( ) : bool
Remove all items from the cache.
setLockConnection ( $connection ) : $this
Specify the name of the connection that should be used to manage locks.
Parameters
- $connection ConnectionInterface
getPrefix ( ) : string
Get the cache key prefix.
serialize ( $value ) : string
Serialize the given value.
Parameters
- $value mixed
unserialize ( $value ) : mixed
Unserialize the given value.
Parameters
- $value string