PHP code example of lysice / laravel-smartcache

1. Go to this page and download the library: Download lysice/laravel-smartcache 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/ */

    

lysice / laravel-smartcache example snippets


        $result = SecondaryCache::remember('your key', $ttl, function () {
            return  [
                'cached' => true
            ];
        });

        app(CacheManager::class)->remember('your key', $ttl, function () {
            return  [
                'cached' => 1
            ];
        });

/**
    public function set($key, $value, $ttl); 设置缓存 支持数组。$key = ['key' => 'value'] $value = null

    public function update($key, $old, $new); 更新缓存

    public function clear(); 清除缓存

    public function decrease($key = '', $step = 1, $ttl = 0); 计数减少

    public function delete($keys); 删除缓存 

    public function exists($keys); 是否存在

    public function get($key); 获取缓存

    public function increase($key = '', $step = 1, $ttl = 0); 计数增加

    public function info(); 返回缓存信息