diff options
Diffstat (limited to 'assets/php/vendor/react/cache/src/ArrayCache.php')
-rw-r--r-- | assets/php/vendor/react/cache/src/ArrayCache.php | 29 |
1 files changed, 29 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]); + } +} |