multi-store/app/common/cache/BaseCache.php

47 lines
824 B
PHP
Raw Normal View History

2024-05-30 21:37:55 +08:00
<?php
namespace app\common\cache;
use support\Cache;
class BaseCache
{
/**
* 缓存标签
* @var string
*/
protected $tagName;
protected $cache;
public function __construct(){
$this->tagName = get_class($this);
}
/**
* @notes 重写父类set自动打上标签
* @param string $key
* @param mixed $value
* @param null $ttl
* @return bool
* @author 乔峰
* @date 2021/12/27 14:16
*/
public function set($key, $value, $ttl = null): bool
{
return Cache::set($key, $value, $ttl);
}
/**
* @notes 清除缓存类所有缓存
* @return bool
* @author 乔峰
* @date 2021/12/27 14:16
*/
public function deleteTag(): bool
{
return Cache::delete($this->tagName);
}
}