class PhpFileCache extends FileCache (View source)

Php file cache driver.

Constants

DOCTRINE_NAMESPACE_CACHEKEY

EXTENSION

Properties

protected string $directory from FileCache
protected $extension {@inheritdoc}

Methods

void
setNamespace(string $namespace)

Set the namespace to prefix all cache ids with.

string
getNamespace()

Retrieve the namespace that prefixes all cache ids.

mixed
fetch(string $id)

Fetches an entry from the cache.

boolean
contains(string $id)

Test if an entry exists in the cache.

boolean
save(string $id, mixed $data, int $lifeTime = 0)

Puts data into the cache.

boolean
delete(string $id)

Deletes a cache entry.

getStats()

Retrieves cached information from data store

boolean
flushAll()

Deletes all cache entries.

boolean
deleteAll()

Delete all cache entries.

string
doFetch(string $id)

Fetches an entry from the cache.

boolean
doContains(string $id)

Test if an entry exists in the cache.

boolean
doSave(string $id, string $data, bool|int $lifeTime = 0)

Puts data into the cache.

boolean
doDelete(string $id)

Deletes a cache entry.

from FileCache
boolean
doFlush()

Deletes all cache entries.

from FileCache
array
doGetStats()

Retrieves cached information from data store

from FileCache
__construct($directory, $extension = null)

Constructor

from FileCache
string
getDirectory()

Gets the cache directory.

from FileCache
string
getExtension()

Gets the cache file extension.

from FileCache
string
getFilename($id)

No description

from FileCache

Details

void setNamespace(string $namespace)

Set the namespace to prefix all cache ids with.

Parameters

string $namespace

Return Value

void

string getNamespace()

Retrieve the namespace that prefixes all cache ids.

Return Value

string

mixed fetch(string $id)

Fetches an entry from the cache.

Parameters

string $id cache id The id of the cache entry to fetch.

Return Value

mixed The cached data or FALSE, if no cache entry exists for the given id.

boolean contains(string $id)

Test if an entry exists in the cache.

Parameters

string $id cache id The cache id of the entry to check for.

Return Value

boolean TRUE if a cache entry exists for the given cache id, FALSE otherwise.

boolean save(string $id, mixed $data, int $lifeTime = 0)

Puts data into the cache.

Parameters

string $id The cache id.
mixed $data The cache entry/data.
int $lifeTime The lifetime. If != 0, sets a specific lifetime for this cache entry (0 => infinite lifeTime).

Return Value

boolean TRUE if the entry was successfully stored in the cache, FALSE otherwise.

boolean delete(string $id)

Deletes a cache entry.

Parameters

string $id cache id

Return Value

boolean TRUE if the cache entry was successfully deleted, FALSE otherwise.

getStats()

Retrieves cached information from data store

The server's statistics array has the following values:

  • hits Number of keys that have been requested and found present.

  • misses Number of items that have been requested and not found.

  • uptime Time that the server is running.

  • memory_usage Memory used by this server to store items.

  • memory_available Memory allowed to use for storage.

boolean flushAll()

Deletes all cache entries.

Return Value

boolean TRUE if the cache entries were successfully flushed, FALSE otherwise.

boolean deleteAll()

Delete all cache entries.

Return Value

boolean TRUE if the cache entries were successfully deleted, FALSE otherwise.

protected string doFetch(string $id)

Fetches an entry from the cache.

Parameters

string $id cache id The id of the cache entry to fetch.

Return Value

string The cached data or FALSE, if no cache entry exists for the given id.

protected boolean doContains(string $id)

Test if an entry exists in the cache.

Parameters

string $id cache id The cache id of the entry to check for.

Return Value

boolean TRUE if a cache entry exists for the given cache id, FALSE otherwise.

protected boolean doSave(string $id, string $data, bool|int $lifeTime = 0)

Puts data into the cache.

Parameters

string $id The cache id.
string $data The cache entry/data.
bool|int $lifeTime The lifetime. If != false, sets a specific lifetime for this cache entry (null => infinite lifeTime).

Return Value

boolean TRUE if the entry was successfully stored in the cache, FALSE otherwise.

protected boolean doDelete(string $id)

Deletes a cache entry.

Parameters

string $id cache id

Return Value

boolean TRUE if the cache entry was successfully deleted, FALSE otherwise.

protected boolean doFlush()

Deletes all cache entries.

Return Value

boolean TRUE if the cache entry was successfully deleted, FALSE otherwise.

protected array doGetStats()

Retrieves cached information from data store

Return Value

array An associative array with server's statistics if available, NULL otherwise.

__construct($directory, $extension = null)

Constructor

Parameters

$directory
$extension

Exceptions

InvalidArgumentException

string getDirectory()

Gets the cache directory.

Return Value

string

string getExtension()

Gets the cache file extension.

Return Value

string

protected string getFilename($id)

Parameters

$id

Return Value

string