class Illuminate / Cache / DatabaseStore
You're browsing the documentation for an upcoming version of Laravel. The documentation and features of this release are subject to change.

DatabaseStore

Implements

Uses

Properties

protected

$connection ConnectionInterface

The database connection instance.

Default: null
protected

$lockConnection ConnectionInterface

The database connection instance that should be used to manage locks.

Default: null
protected

$table string

The name of the cache table.

Default: null
protected

$prefix string

A string that should be prepended to keys.

Default: null
protected

$lockTable string

The name of the cache locks table.

Default: null
protected

$lockLottery array

An array representation of the lock lottery odds.

Default: null
protected

$defaultLockTimeoutInSeconds int

The default number of seconds that a lock should be held.

Default: null

Methods

public

__construct ( ConnectionInterface $connection , $table , $prefix , $lockTable , $lockLottery , $defaultLockTimeoutInSeconds ) : void

Create a new database store.

Parameters

public

get ( $key ) : mixed

Retrieve an item from the cache by key.

Parameters

  • $key string|array
public

put ( $key , $value , $seconds ) : bool

Store an item in the cache for a given number of seconds.

Parameters

  • $key string
  • $value mixed
  • $seconds int
public

add ( $key , $value , $seconds ) : bool

Store an item in the cache if the key doesn't exist.

Parameters

  • $key string
  • $value mixed
  • $seconds int
public

increment ( $key , $value ) : int|bool

Increment the value of an item in the cache.

Parameters

  • $key string
  • $value mixed
public

decrement ( $key , $value ) : int|bool

Decrement the value of an item in the cache.

Parameters

  • $key string
  • $value mixed
protected

incrementOrDecrement ( $key , $value , Closure $callback ) : int|bool

Increment or decrement an item in the cache.

Parameters

  • $key string
  • $value mixed
  • $callback Closure
protected

getTime ( ) : int

Get the current system time.

public

forever ( $key , $value ) : bool

Store an item in the cache indefinitely.

Parameters

  • $key string
  • $value mixed
public

lock ( $name , $seconds , $owner ) : Lock

Get a lock instance.

Parameters

  • $name string
  • $seconds int
  • $owner string|null
public

restoreLock ( $name , $owner ) : Lock

Restore a lock instance using the owner identifier.

Parameters

  • $name string
  • $owner string
public

forget ( $key ) : bool

Remove an item from the cache.

Parameters

  • $key string
public

flush ( ) : bool

Remove all items from the cache.

protected

table ( ) : Builder

Get a query builder for the cache table.

public

getConnection ( ) : ConnectionInterface

Get the underlying database connection.

public

setLockConnection ( $connection ) : $this

Specify the name of the connection that should be used to manage locks.

Parameters

public

getPrefix ( ) : string

Get the cache key prefix.

protected

serialize ( $value ) : string

Serialize the given value.

Parameters

  • $value mixed
protected

unserialize ( $value ) : mixed

Unserialize the given value.

Parameters

  • $value string