sanfordown/simple-php-cache

一个简单的PHP缓存库。

dev-master 2019-04-26 20:37 UTC

This package is not auto-updated.

Last update: 2024-09-23 08:13:58 UTC


README

一个简单的PHP缓存库。它实现了文件和内存(APCu)缓存后端。

安装

非常简单

composer require sanzodown/simple-php-cache

使用方法

它们都带有默认配置,所以如果你不介意,可以直接使用。

文件缓存

$cache = new FileCache(
    'your/cache/path',
    'youNameFile'
);

内存缓存

注意,你必须启用APCu扩展。

$cache = new ApcCache(
    3600, // Time to live
);

方法

$cache->set('key', 'Your datas');

$cache->get('test'); // Your datas