src/Contracts/HttpService.php
public static function setCache($name, $value = '', $expired = 3600)
    {
        $cache_file = self::getCacheName($name);
        $content = serialize(['name' => $name, 'value' => $value, 'expired' => time() + intval($expired)]);
        if (!file_put_contents($cache_file, $content)) {
            throw new Exception('local cache error.', 500);
        }
    }
public static function setCache($name, $value = '', $expired = 3600)
    {
        $cache_file = self::getCacheName($name);
        $content = serialize(['name' => $name, 'value' => $value, 'expired' => time() + intval($expired)]);
        if (!file_put_contents($cache_file, $content)) {
            throw new Exception('local cache error.', 500);
        }
    }
缓存配置与存储
@param string $name 缓存名称
@param string $value 缓存内容
@param int $expired 缓存时间(0表示永久缓存)
@throws Exception