PHP code example of qingbing / zf-abstract-cache

1. Go to this page and download the library: Download qingbing/zf-abstract-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/ */

    

qingbing / zf-abstract-cache example snippets


// 实例化
$cache = Object::create([
    'class' => CacheDemo::class,
    'namespace' => 'name',
]);

/* @var $cache CacheDemo */
// 生成一个缓存
$cache->set('name', 'qingbing');
$cache->set('sex', 'nan');

$cache->setMultiple([
    'age' => 19,
    'class' => 1,
    'grade' => 2,
]);

$value = $cache->get('age');
var_dump($value);

$data = $cache->getMultiple([
    'name',
    'grade',
    'age',
]);
var_dump($data);

$cache->delete('age');
$cache->deleteMultiple(['class', 'name']);

$has = $cache->has('grade');
var_dump($has);

$cache->clear();

print_r($cache);