CacheMC

Memcache-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
Memcachehttp://php.net/memcache

CacheMC

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

Properties

memcache

Holds the Memcache object.

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.  Memcache manages it’s own expirations.

Access

public

Returns

boolean Whether the cache is expired or not.

timestamp()

public function timestamp()

Implemented here, but always returns false.  Memcache 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.  Memcache manages it’s own expirations.

Access

public

Returns

boolean Whether the operation was successful.