renpengpeng/php-cache

Make caching easier

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

This package is auto-updated.

Last update: 2025-05-25 09:50:54 UTC


README

Introduce

Php-cache encapsulates Redis, Memcache, Yac, and Apcu cache modes to make PHP cache more convenient.

READEME.md Chinese

Install

composer require renpengpeng/php-cache

Example

<?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();

Manual

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