PHP Класс Habari\Cache

Base abstract class for caching computationally expensive or bandwidth intensive data
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$cache_class
$default_group
$instance

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

Метод Описание
__static ( ) Set up the static cache instance in __autoload()
debug ( )
expire ( mixed $name, string $match_mode = 'strict' ) Expires the named value from the cache.
expired ( mixed $name ) Check if a named value in the cache has expired.
extend ( mixed $name, integer $expiry ) Extend the expiration of the named cached value.
get ( mixed $name ) : mixed Returns the named value from the cache.
get_class ( ) : string Retrieve the class used for caching
get_group ( $group ) : mixed Returns the group from the cache.
has ( mixed $name ) : boolean Is record with $name in the cache?
has_group ( string $group ) : boolean Is group in the cache?
purge ( ) Empty the cache completely
set ( mixed $name, mixed $value, integer $expiry = 3600, boolean $keep = false ) Set the named value in the cache with an expiration.

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

Метод Описание
_expire ( string $name, $group ) A cache instance implements this to expire the named value from the cache.
_expired ( string $name, $group ) A cache instance implements this to expire the named value from the cache.
_extend ( string $name, integer $expiry, $group ) A cache instance implements this to extend the expiration of the named cached value.
_get ( string $name, $group ) : mixed A cache instance implements this to return the named value from the cache.
_get_group ( $group ) : mixed A cache instance implements this to return the group from the cache.
_has ( string $name, $group ) : boolean A cache instance implements this function to return whether a named cache exists.
_has_group ( $group ) : boolean A cache instance implements this function to return whether a group exists.
_set ( string $name, mixed $value, integer $expiry, $group, $keep ) A cache instance implements this to set the named value in the cache with an expiration.

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

Метод Описание
site_unique ( ) : string Return a string unique to this cache so that site caches don't collide

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

__static() публичный статический Метод

Set up the static cache instance in __autoload()
public static __static ( )

_expire() абстрактный защищенный Метод

A cache instance implements this to expire the named value from the cache.
abstract protected _expire ( string $name, $group )
$name string The name of the cached item

_expired() абстрактный защищенный Метод

A cache instance implements this to expire the named value from the cache.
abstract protected _expired ( string $name, $group )
$name string The name of the cached item

_extend() абстрактный защищенный Метод

A cache instance implements this to extend the expiration of the named cached value.
abstract protected _extend ( string $name, integer $expiry, $group )
$name string The name of the cached item
$expiry integer The duration in seconds to extend the cache expiration by

_get() абстрактный защищенный Метод

A cache instance implements this to return the named value from the cache.
abstract protected _get ( string $name, $group ) : mixed
$name string The name of the cached item
Результат mixed The item value or null if it doesn't exist in cache

_get_group() абстрактный защищенный Метод

A cache instance implements this to return the group from the cache.
abstract protected _get_group ( $group ) : mixed
Результат mixed The item value or null if it doesn't exist in cache

_has() абстрактный защищенный Метод

A cache instance implements this function to return whether a named cache exists.
abstract protected _has ( string $name, $group ) : boolean
$name string The name of the cached item
Результат boolean true if the item is cached, false if not

_has_group() абстрактный защищенный Метод

A cache instance implements this function to return whether a group exists.
abstract protected _has_group ( $group ) : boolean
Результат boolean true if the group is cached, false if not

_set() абстрактный защищенный Метод

A cache instance implements this to set the named value in the cache with an expiration.
abstract protected _set ( string $name, mixed $value, integer $expiry, $group, $keep )
$name string The name of the cached item
$value mixed The value to store
$expiry integer Number of second after the call that the cache will expire

debug() публичный статический Метод

public static debug ( )

expire() публичный статический Метод

Expires the named value from the cache.
public static expire ( mixed $name, string $match_mode = 'strict' )
$name mixed The name of the cached item or an array of array( string $group, string $name )
$match_mode string (optional) how to match item names ('strict', 'regex', 'glob') (default 'strict')

expired() публичный статический Метод

Check if a named value in the cache has expired.
public static expired ( mixed $name )
$name mixed The name of the cached item or an array of array( string $group, string $name )

extend() публичный статический Метод

Extend the expiration of the named cached value.
public static extend ( mixed $name, integer $expiry )
$name mixed The name of the cached item or an array of array( string $group, string $name )
$expiry integer The duration in seconds to extend the cache expiration by

get() публичный статический Метод

Returns the named value from the cache.
public static get ( mixed $name ) : mixed
$name mixed The name of the cached item or an array of array( string $group, string $name )
Результат mixed The item value or null if it doesn't exist in cache

get_class() публичный статический Метод

Retrieve the class used for caching
public static get_class ( ) : string
Результат string The class used for caching

get_group() публичный статический Метод

Returns the group from the cache.
public static get_group ( $group ) : mixed
Результат mixed The item value or null if it doesn't exist in cache

has() публичный статический Метод

Is record with $name in the cache?
public static has ( mixed $name ) : boolean
$name mixed name of the cached item or an array of array( string $group, string $name )
Результат boolean true if item is cached, false if not

has_group() публичный статический Метод

Is group in the cache?
public static has_group ( string $group ) : boolean
$group string name of the cached group
Результат boolean true if group is cached, false if not

purge() публичный статический Метод

Empty the cache completely
public static purge ( )

set() публичный статический Метод

Set the named value in the cache with an expiration.
public static set ( mixed $name, mixed $value, integer $expiry = 3600, boolean $keep = false )
$name mixed The name of the cached item or an array of array( string $group, string $name )
$value mixed The value to store
$expiry integer Number of second after the call that the cache will expire
$keep boolean If true, retain the cache value even after expiry but report the cache as expired

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

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

protected static $cache_class

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

protected static $default_group

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

protected static $instance