renpengpeng/php-cache

v1.0.0 2021-09-23 02:01 UTC

This package is auto-updated.

Last update: 2024-09-25 08:03:19 UTC


README

介绍

Php-cache 封装了 Redis、Memcache、Yac 和 Apcu 缓存模式,使 PHP 缓存更加方便。

READEME.md 中文

安装

composer require renpengpeng/php-cache

示例

<?php
require '../vendor/autoload.php';

use renpengpeng\Cache;

Cache::connect([
	'type'	=>	'File',
	'file'	=>	[
		'cache_dir'	=>	realpath(__DIR__).DIRECTORY_SEPARATOR.'cache'
	]
],true);

// Set the cache 60 seconds
Cache::set('version','1.0.0',60);

// Get the cache
Cache::get('version','1.0.0');

// Since the increase
Cache::increment('version');

// Since the reduction of
Cache::reduction('version');

// Delay is permanent
Cache::delay('version');

// Delete the cache
Cache::delete('version');

// Clear the cache
Cache::clear();

手册

语雀:https://www.yuque.com/ha-renpengpeng/php-cache