PHP 클래스 Stash_model

저자: Mark Croxton ([email protected])
상속: extends CI_Model
파일 보기 프로젝트 열기: croxton/stash 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$EE

보호된 프로퍼티들

프로퍼티 타입 설명
$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