PHP Класс Stash_model

Автор: Mark Croxton ([email protected])
Наследование: extends CI_Model
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$EE

Защищенные свойства (Protected)

Свойство Тип Описание
$bundle_ids default bundle types
$inserted_keys
$keys
$queue

Открытые методы

Метод Описание
__construct ( )
bundle_entry_count ( $bundle_id, $site_id = 1 ) : boolean Count the number of entries for a given bundle
bundle_entry_exists ( $bundle_id, $site_id = 1 ) : integer Check if there is at least one entry for the bundle in this site
delete_key ( string $key, integer/boolean $bundle_id = FALSE, string $session_id = NULL, integer $site_id = 1, integer $invalidate ) : boolean Delete key(s) by name, optionally limited to keys registered with the user session
delete_matching_keys ( integer/boolean $bundle_id = FALSE, string $session_id = NULL, integer $site_id = 1, string $regex = NULL, integer $invalidate ) : boolean Delete key(s) matching a regular expression, and/or scope, and/or bundle
flush_cache ( integer $site_id = 1 ) : boolean Flush the entire cache for a given site, immediately
get_bundle_by_id ( integer $bundle_id ) : integer Get a bundle name from the id
get_bundle_by_name ( string $bundle ) : integer Get a bundle id from the name
get_index_key ( ) : string Getter: returns the index key placeholder
get_key ( string $key, $bundle_id = 1, string $session_id = '', integer $site_id = 1, string $col = 'parameters' ) : string Get key value
get_key_expiry ( string $key, $bundle_id = 1, string $session_id = '', integer $site_id = 1 ) : timestamp Get key expiry date
get_queue ( ) : object Get the Queue object by reference
insert_bundle ( string $bundle, integer $bundle_label = '' ) Insert a bundle
insert_key ( string $key, integer $bundle_id = 1, string $session_id, integer $site_id = 1, integer $expire, string $parameters = '', string $label = '' ) : boolean Insert key for user session
is_inserted_key ( string $cache_key ) : boolean Check to see if a key has been inserted within this page load
parse_uri_from_key ( string $key ) : string Parse a URI from a stash variable key (typically, the uri of a cached page)
process_queue ( ) : boolean Process queued queries
prune_keys ( ) : boolean Prune expired keys
refresh_key ( string $key, $bundle_id = 1, string $session_id = '', integer $site_id = 1, integer $refresh ) : boolean Refresh key for user session
update_key ( string $key, $bundle_id = 1, string $session_id = '', integer $site_id = 1, integer $expire, string $parameters = NULL ) : boolean Update key for user session

Защищенные методы

Метод Описание
delete_cache ( array $vars, boolean $clear_static = TRUE, integer $invalidate, $call_hook = TRUE ) : boolean Delete an array of variables in a given site
delete_static_cache ( integer $key, string $bundle_id, $site_id ) : boolean Delete the associated static file for a given variable
insert_ignore_batch ( string $table, array $data ) : Null Prepare INSERT IGNORE BATCH SQL query
queue_insert ( string $table, string $cache_key, Array $data ) : boolean Queue an insert for batch processing later
queue_update ( string $table, string $cache_key, Array $data, Array $where ) : boolean Queue an update for batch processing later
write_static_cache ( string $key, integer $bundle_id, $site_id, string $parameters ) : boolean Check if the variable can be cached as a static file and write it

Приватные методы

Метод Описание
_can_static_cache ( integer $bundle_id ) : boolean Check that static cache is enabled, and the bundle is static
_delete_dir ( string $uri, $site_id ) : boolean Recursively delete directories and files in a static cache directory
_delete_file ( string $uri = '/', $site_id ) : boolean Delete a static file
_invalidate ( array $ids, integer $period ) : boolean Update variables to expire at random intervals within the invalidation period and so help prevent cache stampedes
_path ( string $uri = '/', $site_id ) : string/boolean Returns the path to the cache directory, if it exists
_write_file ( string $uri, $site_id, string $parameters = NULL ) : boolean Write a static file

Описание методов

__construct() публичный Метод

public __construct ( )

bundle_entry_count() публичный Метод

Count the number of entries for a given bundle
public bundle_entry_count ( $bundle_id, $site_id = 1 ) : boolean
Результат boolean

bundle_entry_exists() публичный Метод

Check if there is at least one entry for the bundle in this site
public bundle_entry_exists ( $bundle_id, $site_id = 1 ) : integer
Результат integer

delete_cache() защищенный Метод

Delete an array of variables in a given site
protected delete_cache ( array $vars, boolean $clear_static = TRUE, integer $invalidate, $call_hook = TRUE ) : boolean
$vars array An array of objects
$clear_static boolean Clear the static cache too, for variables in the static bundle?
$invalidate integer Delay until cached item expires (seconds)
Результат boolean

delete_key() публичный Метод

Delete key(s) by name, optionally limited to keys registered with the user session
public delete_key ( string $key, integer/boolean $bundle_id = FALSE, string $session_id = NULL, integer $site_id = 1, integer $invalidate ) : boolean
$key string
$bundle_id integer/boolean
$session_id string
$site_id integer
$invalidate integer Delay until cached item expires (seconds)
Результат boolean

delete_matching_keys() публичный Метод

Delete key(s) matching a regular expression, and/or scope, and/or bundle
public delete_matching_keys ( integer/boolean $bundle_id = FALSE, string $session_id = NULL, integer $site_id = 1, string $regex = NULL, integer $invalidate ) : boolean
$bundle_id integer/boolean
$session_id string
$site_id integer
$regex string a regular expression
$invalidate integer Delay until cached item expires (seconds)
Результат boolean

delete_static_cache() защищенный Метод

Delete the associated static file for a given variable
protected delete_static_cache ( integer $key, string $bundle_id, $site_id ) : boolean
$key integer
$bundle_id string
Результат boolean

flush_cache() публичный Метод

Flush the entire cache for a given site, immediately
public flush_cache ( integer $site_id = 1 ) : boolean
$site_id integer
Результат boolean

get_bundle_by_id() публичный Метод

Get a bundle name from the id
public get_bundle_by_id ( integer $bundle_id ) : integer
$bundle_id integer
Результат integer

get_bundle_by_name() публичный Метод

Get a bundle id from the name
public get_bundle_by_name ( string $bundle ) : integer
$bundle string
Результат integer

get_index_key() публичный Метод

Getter: returns the index key placeholder
public get_index_key ( ) : string
Результат string

get_key() публичный Метод

Get key value
public get_key ( string $key, $bundle_id = 1, string $session_id = '', integer $site_id = 1, string $col = 'parameters' ) : string
$key string
$session_id string
$site_id integer
$col string
Результат string

get_key_expiry() публичный Метод

Get key expiry date
public get_key_expiry ( string $key, $bundle_id = 1, string $session_id = '', integer $site_id = 1 ) : timestamp
$key string
$session_id string
$site_id integer
Результат timestamp / boolean

get_queue() публичный Метод

Get the Queue object by reference
public get_queue ( ) : object
Результат object

insert_bundle() публичный Метод

Insert a bundle
public insert_bundle ( string $bundle, integer $bundle_label = '' )
$bundle string
$bundle_label integer

insert_ignore_batch() защищенный Метод

Prepare INSERT IGNORE BATCH SQL query
protected insert_ignore_batch ( string $table, array $data ) : Null
$table string The table to insert into
$data array Array in form of "Column" => "Value", ...
Результат Null

insert_key() публичный Метод

Insert key for user session
public insert_key ( string $key, integer $bundle_id = 1, string $session_id, integer $site_id = 1, integer $expire, string $parameters = '', string $label = '' ) : boolean
$key string
$bundle_id integer
$session_id string
$site_id integer
$expire integer
$parameters string
$label string
Результат boolean

is_inserted_key() публичный Метод

Check to see if a key has been inserted within this page load
public is_inserted_key ( string $cache_key ) : boolean
$cache_key string
Результат boolean

parse_uri_from_key() публичный Метод

Parse a URI from a stash variable key (typically, the uri of a cached page)
public parse_uri_from_key ( string $key ) : string
$key string
Результат string

process_queue() публичный Метод

Process queued queries
public process_queue ( ) : boolean
Результат boolean

prune_keys() публичный Метод

Prune expired keys
public prune_keys ( ) : boolean
Результат boolean

queue_insert() защищенный Метод

Queue an insert for batch processing later
protected queue_insert ( string $table, string $cache_key, Array $data ) : boolean
$table string The table to insert into
$cache_key string Unique key identifying this variable
$data Array Array in form of "Column" => "Value", ...
Результат boolean

queue_update() защищенный Метод

Queue an update for batch processing later
protected queue_update ( string $table, string $cache_key, Array $data, Array $where ) : boolean
$table string The table to insert into
$cache_key string Unique key identifying this variable
$data Array Array in form of "Column" => "Value", ...
$where Array Array in form of "Column" => "Value", ...
Результат boolean

refresh_key() публичный Метод

Refresh key for user session
public refresh_key ( string $key, $bundle_id = 1, string $session_id = '', integer $site_id = 1, integer $refresh ) : boolean
$key string
$session_id string
$site_id integer
$refresh integer Seconds to expiry date
Результат boolean

update_key() публичный Метод

Update key for user session
public update_key ( string $key, $bundle_id = 1, string $session_id = '', integer $site_id = 1, integer $expire, string $parameters = NULL ) : boolean
$key string
$session_id string
$site_id integer
$expire integer
$parameters string
Результат boolean

write_static_cache() защищенный Метод

Check if the variable can be cached as a static file and write it
protected write_static_cache ( string $key, integer $bundle_id, $site_id, string $parameters ) : boolean
$key string
$bundle_id integer
$parameters string
Результат boolean

Описание свойств

$EE публичное свойство

public $EE

$bundle_ids защищенное статическое свойство

default bundle types
protected static $bundle_ids

$inserted_keys защищенное статическое свойство

protected static $inserted_keys

$keys защищенное статическое свойство

protected static $keys

$queue защищенное статическое свойство

protected static $queue