PHP code example of lsys / cache

1. Go to this page and download the library: Download lsys/cache library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

lsys / cache example snippets


$cache=\LSYS\Cache\DI::get()->cache();
// 设置缓存
var_dump($cache->set("a1231231df","b"));
// 获取缓存
var_dump($cache->get("a1231231df"));
// 判断缓存是否存在
var_dump($cache->exist("a1231231df"));
// 删除缓存
var_dump($cache->delete("a1231231df"));
// 删除所有缓存,注意:系统消耗大,不建议频繁调用
var_dump($cache->delete_all());

$cache=\LSYS\Cache\DI::get()->cache();
// 设置缓存,注意:通过tag_set设置数据通过get函数不可获取..
$tag=array('tag1');
var_dump($cache->tag_set("a1231231df","b",$tag));
// 获取缓存
var_dump($cache->tag_get("a1231231df"));
// 通过tag获取缓存
var_dump($cache->tag_find("tag1"));
// 通过tag删除某个缓存
var_dump($cache->tag_delete("tag1"));