extends abstract class Phalcon\Cache\Backend
implements Phalcon\Cache\BackendInterface
Allows to cache output fragments using a file backend
//Cache the file for 2 days $frontendOptions = array( 'lifetime' => 172800 ); //Create a output cache $frontCache = \Phalcon\Cache\Frontend\Output($frontOptions); //Set the cache directory $backendOptions = array( 'cacheDir' => '../app/cache/' ); //Create the File backend $cache = new \Phalcon\Cache\Backend\File($frontCache, $backendOptions); $content = $cache->start('my-cache'); if ($content === null) { echo '<h1>', time(), '</h1>'; $cache->save(); } else { echo $content; }
Phalcon\Cache\Backend\File constructor
Returns a cached content
Stores cached content into the file backend and stops the frontend
Deletes a value from the cache by its key
Query the existing cached keys
Checks if cache exists and it isn’t expired
Increment of a given key, by number $value
Decrement of a given key, by number $value
Immediately invalidates all existing items.
Starts a cache. The $keyname allows to identify the created fragment
Stops the frontend without store any cached content
Returns front-end instance adapter related to the back-end
Returns the backend options
Checks whether the last cache is fresh or cached
Checks whether the cache has starting buffering or not
Sets the last key used in the cache
Gets the last key stored by the cache
Gets the last lifetime set
© 2011–2016 Phalcon Framework Team
Licensed under the Creative Commons Attribution License 3.0.
https://docs.phalconphp.com/en/2.0.0/api/Phalcon_Cache_Backend_File.html