2017 © Pedro Peláez
 

library phpcache

php cache from thinkphp5

image

king192/phpcache

php cache from thinkphp5

  • Wednesday, August 23, 2017
  • by king192
  • Repository
  • 1 Watchers
  • 0 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

/** * 缓存管理 * @param mixed $name 缓存名称,如果为数组表示进行缓存设置 * @param mixed $value 缓存值 * @param mixed $options 缓存参数 * @param string $tag 缓存标签 * @return mixed */ function cache($name, $value = '', $options = null, $tag = null) { define('CACHE_PATH', S_ROOT . 'cache');, (*1)

require S_ROOT . 'vendor/autoload.php';
if (is_array($options)) {
    // 缓存操作的同时初始化
    \king192\phpcache\Cache::connect($options);
} elseif (is_array($name)) {
    // 缓存初始化
    return \king192\phpcache\Cache::connect($name);
}
if (is_null($name)) {
    return \king192\phpcache\Cache::clear($value);
} elseif ('' === $value) {
    // 获取缓存
    return 0 === strpos($name, '?') ? \king192\phpcache\Cache::has(substr($name, 1)) : \king192\phpcache\Cache::get($name);
} elseif (is_null($value)) {
    // 删除缓存
    return \king192\phpcache\Cache::rm($name);
} elseif (0 === strpos($name, '?') && '' !== $value) {
    $expire = is_numeric($options) ? $options : null;
    return \king192\phpcache\Cache::remember(substr($name, 1), $value, $expire);
} else {
    // 缓存数据
    if (is_array($options)) {
        $expire = isset($options['expire']) ? $options['expire'] : null; //修复查询缓存无法设置过期时间
    } else {
        $expire = is_numeric($options) ? $options : null; //默认快捷缓存设置过期时间
    }
    if (is_null($tag)) {
        return \king192\phpcache\Cache::set($name, $value, $expire);
    } else {
        return \king192\phpcache\Cache::tag($tag)->set($name, $value, $expire);
    }
}

}, (*2)

The Versions

23/08 2017

dev-master

9999999-dev

php cache from thinkphp5

  Sources   Download

Apache2.0

20/08 2017

v1.0.0.x-dev

1.0.0.9999999-dev

php cache from thinkphp5

  Sources   Download

Apache2.0

20/08 2017

v1.0.x-dev

1.0.9999999.9999999-dev

php cache from thinkphp5

  Sources   Download

Apache2.0