\CI_DB_Cache

Database Cache Class

Summary

Methods
Properties
Constants
__construct()
check_path()
read()
write()
delete()
delete_all()
$CI
$db
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$CI

$CI : object

CI Singleton

Type

object

$db

$db : object

Database object

Allows passing of DB object so that multiple database connections and returned DB objects can be supported.

Type

object

Methods

__construct()

__construct(  $db) : void

Constructor

Parameters

$db

check_path()

check_path(string  $path = '') : boolean

Set Cache Directory Path

Parameters

string $path

Path to the cache directory

Returns

boolean

read()

read(string  $sql) : string

Retrieve a cached query

The URI being requested will become the name of the cache sub-folder. An MD5 hash of the SQL statement will become the cache file name.

Parameters

string $sql

Returns

string

write()

write(string  $sql, object  $object) : boolean

Write a query to a cache file

Parameters

string $sql
object $object

Returns

boolean

delete()

delete(string  $segment_one = '', string  $segment_two = '') : void

Delete cache files within a particular directory

Parameters

string $segment_one
string $segment_two

delete_all()

delete_all() : void

Delete all existing cache files