class JSONCache

  1. 8.0.x lib/Drush/Cache/JSONCache.php JSONCache
  2. 7.x lib/Drush/Cache/JSONCache.php JSONCache
  3. master lib/Drush/Cache/JSONCache.php JSONCache

JSON cache storage backend.




Expanded class hierarchy of JSONCache


Contains filters are case sensitive
Namesort descending Modifiers Type Description
FileCache::$bin protected property
FileCache::cacheDirectory function Returns the cache directory for the given bin.
FileCache::clear function Expire data from the cache. If called without arguments, expirable entries will be cleared from all known cache bins. Overrides CacheInterface::clear
FileCache::get function Return data from the persistent cache. Overrides CacheInterface::get
FileCache::getFilePath protected function Converts a cache id to a full path.
FileCache::getMultiple function Return data from the persistent cache when given an array of cache IDs. Overrides CacheInterface::getMultiple
FileCache::isEmpty function Check if a cache bin is empty. Overrides CacheInterface::isEmpty
FileCache::set function Store data in the persistent cache. Overrides CacheInterface::set
FileCache::__construct function Constructor. Overrides CacheInterface::__construct
JSONCache::EXTENSION constant Overrides FileCache::EXTENSION
JSONCache::readFile function Returns the contents of the given filename unserialized. Overrides FileCache::readFile
JSONCache::writeFile function Serializes data and write it to the given filename. Overrides FileCache::writeFile


lib/Drush/Cache/JSONCache.php, line 13
Definition of Drush\Cache\JSONCache.

View source
class JSONCache extends FileCache {
  const EXTENSION = '.json';

  function readFile($filename) {
    $item = file_get_contents($filename);
    return $item ? (object) drush_json_decode($item) : FALSE;

  function writeFile($filename, $cache) {
    return file_put_contents($filename, drush_json_encode($cache));