PHP Class Minify_Cache_Memcache, minify

fall back to disk caching if memcache can't connect $memcache = new Memcache; if ($memcache->connect('localhost', 11211)) { Minify::setCache(new Minify_Cache_Memcache($memcache)); } else { Minify::setCache(); }
Afficher le fichier Open project: mrclay/minify Class Usage Examples

Méthodes publiques

Méthode Description
__construct ( Memcache $memcache, integer $expire ) Create a Minify_Cache_Memcache object, to be passed to Minify::setCache().
display ( string $id ) Send the cached content to output
fetch ( string $id ) : string Fetch the cached content
getSize ( string $id ) : integer Get the size of a cache entry
isValid ( string $id, integer $srcMtime ) : boolean Does a valid cache entry exist?
store ( string $id, string $data ) : boolean Write data to cache.

Private Methods

Méthode Description
_fetch ( string $id ) : boolean Fetch data and timestamp from memcache, store in instance

Method Details

__construct() public méthode

Create a Minify_Cache_Memcache object, to be passed to Minify::setCache().
public __construct ( Memcache $memcache, integer $expire )
$memcache Memcache already-connected instance
$expire integer seconds until expiration (default = 0 meaning the item will not get an expiration date)

display() public méthode

Send the cached content to output
public display ( string $id )
$id string cache id

fetch() public méthode

Fetch the cached content
public fetch ( string $id ) : string
$id string cache id
Résultat string

getSize() public méthode

Get the size of a cache entry
public getSize ( string $id ) : integer
$id string cache id
Résultat integer size in bytes

isValid() public méthode

Does a valid cache entry exist?
public isValid ( string $id, integer $srcMtime ) : boolean
$id string cache id
$srcMtime integer mtime of the original source file(s)
Résultat boolean exists

store() public méthode

Write data to cache.
public store ( string $id, string $data ) : boolean
$id string cache id
$data string
Résultat boolean success