1 | <?php /** MicroCache */ |
||
19 | class Cache |
||
20 | { |
||
21 | /** @var array $drivers Supported drivers */ |
||
22 | protected static $drivers = [ |
||
23 | 'apc' => '\\Micro\\Cache\\Driver\\ApcDriver', |
||
24 | 'array' => '\\Micro\\Cache\\Driver\\ArrayDriver', |
||
25 | 'db' => '\\Micro\\Cache\\Driver\\DbDriver', |
||
26 | 'file' => '\\Micro\\Cache\\Driver\\FileDriver', |
||
27 | 'memcache' => '\\Micro\\Cache\\Driver\\MemcachedDriver', |
||
28 | 'memcached' => '\\Micro\\Cache\\Driver\\MemcachedDriver', |
||
29 | 'redis' => '\\Micro\\Cache\\Driver\\RedisDriver', |
||
30 | 'wincache' => '\\Micro\\Cache\\Driver\\WincacheDriver', |
||
31 | 'xcache' => '\\Micro\\Cache\\Driver\\XcacheDriver' |
||
32 | ]; |
||
33 | |||
34 | /** @var array $servers Activated servers */ |
||
35 | protected $servers = []; |
||
36 | |||
37 | |||
38 | /** |
||
39 | * Constructor is a initialize Caches |
||
40 | * |
||
41 | * @access public |
||
42 | * |
||
43 | * @param array $servers |
||
44 | * |
||
45 | * @result void |
||
46 | * @throws Exception |
||
47 | */ |
||
48 | public function __construct(array $servers) |
||
58 | |||
59 | /** |
||
60 | * Get cache server by name |
||
61 | * |
||
62 | * @access public |
||
63 | * |
||
64 | * @param string $driver server name |
||
65 | * |
||
66 | * @return mixed |
||
67 | * @throws Exception |
||
68 | */ |
||
69 | public function get($driver = null) |
||
81 | } |
||
82 |
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: