2 namespace Consolidation\TestUtils;
4 use Consolidation\AnnotatedCommand\Cache\SimpleCacheInterface;
7 * A simple in-memory cache for testing
9 class InMemoryCacheStore implements SimpleCacheInterface
13 public function __construct()
19 * Test for an entry from the cache
23 public function has($key)
25 return array_key_exists($key, $this->cache);
29 * Get an entry from the cache
33 public function get($key)
35 if (!$this->has($key)) {
38 return $this->cache[$key];
42 * Store an entry in the cache
46 public function set($key, $data)
48 $this->cache[$key] = $data;