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