Version 1
[yaffs-website] / vendor / drush / drush / lib / Drush / Cache / JSONCache.php
diff --git a/vendor/drush/drush/lib/Drush/Cache/JSONCache.php b/vendor/drush/drush/lib/Drush/Cache/JSONCache.php
new file mode 100644 (file)
index 0000000..6c6b373
--- /dev/null
@@ -0,0 +1,24 @@
+<?php
+
+/**
+ * @file
+ * Definition of Drush\Cache\JSONCache.
+ */
+
+namespace Drush\Cache;
+
+/**
+ * JSON cache storage backend.
+ */
+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));
+  }
+}