JSONCache.php

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

Definition of Drush\Cache\JSONCache.

Namespace

Drush\Cache

Classes

Namesort descending Description
JSONCache JSON cache storage backend.

File

lib/Drush/Cache/JSONCache.php
View source
  1. <?php
  2. /**
  3. * @file
  4. * Definition of Drush\Cache\JSONCache.
  5. */
  6. namespace Drush\Cache;
  7. /**
  8. * JSON cache storage backend.
  9. */
  10. class JSONCache extends FileCache {
  11. const EXTENSION = '.json';
  12. function readFile($filename) {
  13. $item = file_get_contents($filename);
  14. return $item ? (object)drush_json_decode($item) : FALSE;
  15. }
  16. function writeFile($filename, $cache) {
  17. return file_put_contents($filename, drush_json_encode($cache));
  18. }
  19. }