aboutsummaryrefslogtreecommitdiffhomepage
path: root/assets/php/vendor/react/cache/src
diff options
context:
space:
mode:
Diffstat (limited to 'assets/php/vendor/react/cache/src')
-rw-r--r--assets/php/vendor/react/cache/src/ArrayCache.php29
-rw-r--r--assets/php/vendor/react/cache/src/CacheInterface.php13
2 files changed, 42 insertions, 0 deletions
diff --git a/assets/php/vendor/react/cache/src/ArrayCache.php b/assets/php/vendor/react/cache/src/ArrayCache.php
new file mode 100644
index 0000000..03dcc15
--- /dev/null
+++ b/assets/php/vendor/react/cache/src/ArrayCache.php
@@ -0,0 +1,29 @@
+<?php
+
+namespace React\Cache;
+
+use React\Promise;
+
+class ArrayCache implements CacheInterface
+{
+ private $data = array();
+
+ public function get($key)
+ {
+ if (!isset($this->data[$key])) {
+ return Promise\reject();
+ }
+
+ return Promise\resolve($this->data[$key]);
+ }
+
+ public function set($key, $value)
+ {
+ $this->data[$key] = $value;
+ }
+
+ public function remove($key)
+ {
+ unset($this->data[$key]);
+ }
+}
diff --git a/assets/php/vendor/react/cache/src/CacheInterface.php b/assets/php/vendor/react/cache/src/CacheInterface.php
new file mode 100644
index 0000000..fd5f2d5
--- /dev/null
+++ b/assets/php/vendor/react/cache/src/CacheInterface.php
@@ -0,0 +1,13 @@
+<?php
+
+namespace React\Cache;
+
+interface CacheInterface
+{
+ // @return React\Promise\PromiseInterface
+ public function get($key);
+
+ public function set($key, $value);
+
+ public function remove($key);
+}