Documentation

Database extends AbstractAdapter
in package

Database cache adapter class

Tags
category

Pop

author

Nick Sagona, III dev@nolainteractive.com

copyright

Copyright (c) 2009-2024 NOLA Interactive, LLC. (http://www.nolainteractive.com)

license

http://www.popphp.org/license New BSD License

version
4.0.0

Table of Contents

Properties

$db  : AbstractAdapter|null
Database adapter
$table  : string
Cache db table
$ttl  : int
Global time-to-live

Methods

__construct()  : mixed
Constructor
clear()  : Database
Clear all stored values from cache
deleteItem()  : Database
Delete a value in cache
destroy()  : Database
Destroy cache resource
getDb()  : AbstractAdapter
Get the current cache db adapter.
getItem()  : mixed
Get an item from cache
getItemTtl()  : int
Get the time-to-live for an item in cache
getTable()  : string
Get the current cache db table.
getTtl()  : int
Get the global time-to-live for the cache object
hasItem()  : bool
Determine if the item exist in cache
saveItem()  : Database
Save an item to cache
setDb()  : Database
Set the current cache db adapter.
setTable()  : Database
Set the cache db table
setTtl()  : AbstractAdapter
Set the global time-to-live for the cache adapter
createTable()  : void
Create table in database

Properties

$table

Cache db table

protected string $table = 'pop_cache'

Methods

__construct()

Constructor

public __construct(AbstractAdapter $db[, int $ttl = 0 ][, string $table = 'pop_cache' ]) : mixed

Instantiate the DB writer object

The DB table requires the following fields at a minimum:

id    INT
key   VARCHAR
start INT
ttl   INT
value TEXT, VARCHAR, etc.
Parameters
$db : AbstractAdapter
$ttl : int = 0
$table : string = 'pop_cache'

deleteItem()

Delete a value in cache

public deleteItem(string $id) : Database
Parameters
$id : string
Return values
Database

getItem()

Get an item from cache

public getItem(string $id) : mixed
Parameters
$id : string

getItemTtl()

Get the time-to-live for an item in cache

public getItemTtl(string $id) : int
Parameters
$id : string
Return values
int

getTable()

Get the current cache db table.

public getTable() : string
Return values
string

getTtl()

Get the global time-to-live for the cache object

public getTtl() : int
Return values
int

hasItem()

Determine if the item exist in cache

public hasItem(string $id) : bool
Parameters
$id : string
Return values
bool

saveItem()

Save an item to cache

public saveItem(string $id, mixed $value[, int|null $ttl = null ]) : Database
Parameters
$id : string
$value : mixed
$ttl : int|null = null
Return values
Database

setTable()

Set the cache db table

public setTable(string $table) : Database
Parameters
$table : string
Return values
Database

createTable()

Create table in database

protected createTable() : void

        
On this page

Search results