CacheFile

File-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

CacheFile

Container for all file-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.

timestamp()

public function timestamp()

Retrieves the timestamp of the cache.

Access

public

Returns

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

reset()

public function reset()

Resets the freshness of the cache.

Access

public

Returns

boolean Whether the operation was successful.

is_expired()

public function is_expired()

Checks whether the cache object is expired or not.

Access

public

Returns

boolean Whether the cache is expired or not.