function exists($key, &$val = NULL)
{
$fw = Base::instance();
if (!$this->dsn) {
return FALSE;
}
$ndx = $this->prefix . '.' . $key;
$parts = explode('=', $this->dsn, 2);
switch ($parts[0]) {
case 'apc':
case 'apcu':
$raw = apc_fetch($ndx);
break;
case 'redis':
$raw = $this->ref->get($ndx);
break;
case 'memcache':
$raw = memcache_get($this->ref, $ndx);
break;
case 'wincache':
$raw = wincache_ucache_get($ndx);
break;
case 'xcache':
$raw = xcache_get($ndx);
break;
case 'folder':
$raw = $fw->read($parts[1] . $ndx);
break;
}
if (!empty($raw)) {
list($val, $time, $ttl) = (array) $fw->unserialize($raw);
if ($ttl === 0 || $time + $ttl > microtime(TRUE)) {
return [$time, $ttl];
}
$val = null;
$this->clear($key);
}
return FALSE;
}