定制 piotrpress/cacher 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

piotrpress/cacher

最新稳定版本:v1.2.0

Composer 安装命令:

composer require piotrpress/cacher

包简介

This library provides a simple file-based caching solution.

README 文档

README

This library provides a simple file-based caching solution.

Installation

$ composer require piotrpress/cacher

Usage

require __DIR__ . '/vendor/autoload.php';

use PiotrPress\Cacher;

$cache = new Cacher( '.cache', 3600 );

$value = $cache->get( 'hi', function ( $arg1, $arg2 ) {
    return "$arg1 $arg2";
}, 'Hello', 'world!' );

$cache->clear( 'hi' ); // clear cache for "hi" key
$cache->clear(); // clear all cache

You can use php://memory as a file to store cache in memory, for instance, while developing or testing.

Cacher takes an expiration time in seconds as the second argument. By default, it is set to -1, which means the cache never expires. If the value 0 is provided, the cache will be cleared on every call.

Requirements

Supports PHP >= 7.4 version.

License

MIT

统计信息

  • 总下载量: 107
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-10-29