Database-based caching class using PHP Data Objects (PDO).
2008.11.30
2006-2008 LifeNexus Digital, Inc., and contributors.
| Simplified BSD License | http://opensource.org/licenses/bsd-license.php |
| Tarzan | http://tarzan-aws.com |
| PDO | http://php.net/pdo |
public function __construct( $name, $location, $expires )
The constructor.
Tested with MySQL 5.0.x (http://mysql.com), PostgreSQL (http://postgresql.com), and SQLite 3.x (http://sqlite.org). SQLite 2.x is assumed to work. No other PDO-supported databases have been tested (e.g. Oracle, Microsoft SQL Server, IBM DB2, ODBC, Sybase, Firebird). Feel free to send patches for additional database support. See http://php.net/pdo for more information.
public
| name | string (Required) A name to uniquely identify the cache object. |
| location | string (Required) The location to store the cache object in. This may vary by cache method. |
| expires | integer (Required) The number of seconds until a cache object is considered stale. |
object Reference to the cache object.
| Example Usage | http://tarzan-aws.com |
public function create( $data )
Creates a new cache.
public
| data | mixed (Required) The data to cache. |
boolean Whether the operation was successful.
| Example Usage | http://tarzan-aws.com |
public function read()
Reads a cache.
public
mixed Either the content of the cache object, or boolean false.
| Example Usage | http://tarzan-aws.com |
public function update( $data )
Updates an existing cache.
public
| data | mixed (Required) The data to cache. |
boolean Whether the operation was successful.
| Example Usage | http://tarzan-aws.com |
public function reset()
Resets the freshness of the cache.
public
boolean Whether the operation was successful.
| Example Usage | http://tarzan-aws.com |
public function is_expired()
Checks whether the cache object is expired or not.
public
boolean Whether the cache is expired or not.
| Example Usage | http://tarzan-aws.com |
public function get_drivers()
Returns a list of supported PDO database drivers. Identical to PDO::getAvailableDrivers().
public
array The list of supported database drivers.
| PHP Method | http://php.net/pdo.getavailabledrivers |