Commit b4946025 authored by 王源's avatar 王源 🎧

添加缓存工具类

parent 2e963430
<?php
namespace Meibuyu\Micro\Tools;
use Psr\SimpleCache\CacheInterface;
/**
* Class Cache
* @package Meibuyu\Micro\Tools
* @method static get($key, $default = null)
* @method static set($key, $value, $ttl = null)
* @method static delete($key)
* @method static clear()
* @method static getMultiple($keys, $default = null)
* @method static setMultiple($values, $ttl = null)
* @method static deleteMultiple($keys)
* @method static has($key)
*/
class Cacher
{
/**
* @var CacheInterface
*/
protected static $driver;
/**
* @return CacheInterface
*/
public static function driver()
{
if (!self::$driver) {
self::$driver = container(CacheInterface::class);
}
return self::$driver;
}
public static function __callStatic($name, $arguments)
{
return static::driver()->{$name}(...$arguments);
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment