1 | <?php /** MicroCache */ |
||
20 | class Cache |
||
21 | { |
||
22 | /** @var array $drivers Supported drivers */ |
||
23 | protected static $drivers = [ |
||
24 | 'array' => '\\Micro\\Cache\\ArrayCache', |
||
25 | 'apc' => '\\Micro\\Cache\\ApcCache', |
||
26 | 'file' => '\\Micro\\Cache\\FileCache', |
||
27 | 'memcache' => '\\Micro\\Cache\\MemcacheCache', |
||
28 | 'memcached' => '\\Micro\\Cache\\MemcacheCache', |
||
29 | 'redis' => '\\Micro\\Cache\\RedisCache', |
||
30 | 'wincache' => '\\Micro\\Cache\\WincacheCache', |
||
31 | 'xcache' => '\\Micro\\Cache\\XcacheCache' |
||
32 | ]; |
||
33 | /** @var array $servers Activated servers */ |
||
34 | protected $servers = []; |
||
35 | /** @var IContainer $container Config container */ |
||
36 | protected $container; |
||
37 | |||
38 | |||
39 | /** |
||
40 | * Constructor is a initialize Caches |
||
41 | * |
||
42 | * @access public |
||
43 | * |
||
44 | * @param array $config Caching config |
||
45 | * |
||
46 | * @result void |
||
47 | * @throws Exception |
||
48 | */ |
||
49 | public function __construct(array $config = []) |
||
67 | |||
68 | /** |
||
69 | * Get cache server by name |
||
70 | * |
||
71 | * @access public |
||
72 | * |
||
73 | * @param string $driver server name |
||
74 | * |
||
75 | * @return mixed |
||
76 | * @throws Exception |
||
77 | */ |
||
78 | public function get($driver = null) |
||
90 | } |
||
91 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: