Skip to content

Simple, efficient cache for php. 简单、高效的 PHP 缓存类

Notifications You must be signed in to change notification settings

mantoufan/yzhanCache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

yzhanCache

Simple, effient cache class for PHP.
简单、高效的 PHP 缓存类

Install 安装

composer require mantoufan/yzhancache

Use 使用

$yzhanCache = new YZhanCache('File'); // Default: File Engine 

File Engine Only: Change Cache Dir

$yzhanCache = new YZhanCache('File', array(
  'dir' => sys_get_temp_dir() . '/yzhancache' // Default Cache Dir
));

Set 设置

$yzhanCache->set($key, $val, $maxAge = null); // Unit of $maxAge is seconds
$yzhanCache->set('1', 'a', 1)->set('2', array(1, 2, 3)) // Chain call

Get 获取

$yzhanCache->get($key);
$yzhanCache->get('1'); // a
$yzhanCache->get('2'); // [1, 2, 3]
$yzhanCache->get('1'); // null, expires over $maxAge

Has 是否存在

$yzhanCache->has($key); // true / false

Delete 删除

$yzhanCache->delete($key);
$yzhanCache->set('1', 'a')->delete('1'); // Chain call

Clear 清空

$yzhanCache->clear();
$yzhanCache->clear()->set('1', 'a')->delete('1'); // Chain call

About

Simple, efficient cache for php. 简单、高效的 PHP 缓存类

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages