实现 psr-16 的 PHP 缓存库。

dev-main 2022-09-18 11:15 UTC

This package is auto-updated.

Last update: 2024-09-18 15:36:56 UTC


README

一个实现 PSR-16 的简单缓存库。

Build Status codecov Latest Stable Version PHP Version Require License Total Downloads

安装

composer require super-simple/cache

需要 PHP 8.1 或更高版本。

使用

基本使用

<?php
require_once __DIR__ . '/../vendor/autoload.php';

use SSCache\CacheService;

$cache = (new CacheService(new YourStorage()));

// Set the value
$cache->set($key, $value, $ttl);

// Get the value
$result = $cache->get($key);

过期时间 $ttl 可以是整数、null 或 \DateInterval

存储必须实现 SSCache\CacheStorageInterface 接口。

如何处理存储中的 $ttl 由您决定。

更多详情请查看 wiki

许可证

Super Simple Cache 是开源软件,许可协议为 MIT 许可证