\Hazaar\Cache\Backend
Database
The database cache backend.

This is another reliable almost always available cache backend, similar to file. However if your database supports clustering/replication such as MySQL or PostgreSQL, then you have just given yourself a cheap reliable clustered cache backend.

This backend works by creating tables in the database server by default with a name of cache_{namespace}. You can of course override this but why would you want to? It works. Just make sure you have your databas environment configred and the user has create privileges.

NOTE: The configuration options are passed directly “as is” to the database backend. This allows the backend to override the default database settings when creating the DBI object. This allows you to have a completely separate database where the cache user has table create privileges in a database that is not where you keep all your important stuff.

Available config options:

  • cache_table – The name of the table to use for this instance of the cache backend. Default: cache_{namespace}.
  • …DBI options… – See the DBI documentation for options you can use to configure your DBI instance.

Tags

Since

1.0.0

Summary
Methods Properties Constants
get
has
set
$db
No constants
Properties
$db
$db
$weight
$weight
Inherited
$weight
$weight
Methods
Static
available()
available()
clear()
clear()
get()
get($key)

Parameters

$key

No description

has()
has($key)

Parameters

$key

No description

init()
init($namespace)

Parameters

$namespace

No description

remove()
remove($key)

Parameters

$key

No description

set()
set($key, $value, $timeout = null)

Parameters

$key

No description

$value

No description

$timeout

No description