<?php
/**
 * Created by PhpStorm.
 * User: dognwenzhang <772009936@qq.com>
 * Date: 2020/02/16   ÏÂÎç14£º58
 */

namespace crmeb\services;


use think\Cache;
use think\facade\Cache as CacheStatic;

class CacheService
{
    protected static $globalCacheName = '_cached_1515146130';


    public static function set($name, $value, $expire = 60)
    {
        return self::handler()->set($name,$value,$expire);
    }

    public static function get($name,$default = false)
    {
        return self::handler()->remember($name,$default);
    }

    public static function rm($name)
    {
        return self::handler()->clear($name);
    }

    public static function handler()
    {
        return CacheStatic::tag(self::$globalCacheName);
    }

    public static function clear()
    {
        return Cache::clear(self::$globalCacheName);
    }
}