CacheXCache

XCache-based caching class.

Version

2009.10.10

Copyright

2006-2009 LifeNexus Digital, Inc., and contributors.

License

Simplified BSD Licensehttp://opensource.org/licenses/bsd-license.php

See Also

CacheCorehttp://cachecore.googlecode.com
CloudFusionhttp://getcloudfusion.com
XCachehttp://xcache.lighttpd.net

CacheXCache

Container for all XCache-based cache methods.  Inherits additional methods from CacheCore.  Adheres to the ICacheCore interface.

Functions

__construct()

public function __construct($name,  
$location,  
$expires,  
$gzip =  true)

The constructor

Access

public

Parameters

namestring (Required) A name to uniquely identify the cache object.
locationstring (Required) The location to store the cache object in.  This may vary by cache method.
expiresinteger (Required) The number of seconds until a cache object is considered stale.
gzipboolean (Optional) Whether data should be gzipped before being stored.  Defaults to true.

Returns

object Reference to the cache object.

create()

public function create($data)

Creates a new cache.

Access

public

Parameters

datamixed (Required) The data to cache.

Returns

boolean Whether the operation was successful.

read()

public function read()

Reads a cache.

Access

public

Returns

mixed Either the content of the cache object, or boolean false.

update()

public function update($data)

Updates an existing cache.

Access

public

Parameters

datamixed (Required) The data to cache.

Returns

boolean Whether the operation was successful.

delete()

public function delete()

Deletes a cache.

Access

public

Returns

boolean Whether the operation was successful.

is_expired()

public function is_expired()

Defined here, but always returns false.  XCache manages it’s own expirations.  It’s worth mentioning that if the server is configured for a long xcache.var_gc_interval then it IS possible for expired data to remain in the var cache, though it is not possible to access it.

Access

public

Returns

boolean Whether the cache is expired or not.

timestamp()

public function timestamp()

Implemented here, but always returns false.  XCache manages it’s own expirations.

Access

public

Returns

mixed Either the Unix time stamp of the cache creation, or boolean false.

reset()

public function reset()

Implemented here, but always returns false.  XCache manages it’s own expirations.

Access

public

Returns

boolean Whether the operation was successful.