| 1 |
<?php |
| 2 |
|
| 3 |
namespace FL\Assistant\System\Container; |
| 4 |
|
| 5 |
class ReflectionCacheArray implements ReflectionCache { |
| 6 |
|
| 7 |
private $cache = []; |
| 8 |
|
| 9 |
public function fetch( $key ) { |
| 10 |
// The additional isset() check here improves performance but we also |
| 11 |
// need array_key_exists() because some cached values === NULL. |
| 12 |
return ( isset( $this->cache[ $key ] ) || array_key_exists( $key, $this->cache ) ) |
| 13 |
? $this->cache[ $key ] |
| 14 |
: false; |
| 15 |
} |
| 16 |
|
| 17 |
public function store( $key, $data ) { |
| 18 |
$this->cache[ $key ] = $data; |
| 19 |
} |
| 20 |
} |
| 21 |
|