承接 arkonsoft/ps-file-cache 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

arkonsoft/ps-file-cache

最新稳定版本:v1.0.0

Composer 安装命令:

composer require arkonsoft/ps-file-cache

包简介

Simple to file caching library

README 文档

README

A simple file cache for PHP

Installation

composer require arkonsoft/ps-file-cache

Usage

Create a new instance of the cache:

use Arkonsoft\PsModule\FileCache;
...
$cache = new FileCache(__DIR__ . '/cache/');

Store a value in the cache:

$cache->store('key', 'value');

Get a value from the cache:

$value = $cache->retrieve('key');

Retrieve method will also check whether the key is expired or not. You can turn off this feature by passing false as the second argument:

$value = $cache->retrieve('key', false);

Important

store() method uses json_encode() to serialize data. You can store any data beside "resource" type. If you'll try to do it exception will be thrown.

Additional methods

Lifetime

Base lifetime is set to 3600 seconds (1h).

You can change it in the constructor:

$cache = new FileCache('path', 6000);

Or later with:

$cache->setLifetime(6000);

IsStored

Check if a key is stored in the cache and is not empty:

$cache->isStored('key');

IsExpired

Check if a key is stored in the cache and is expired:

$cache->isExpired('key');

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-08-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固