承接 alirezaashrafi/php-file-cache 相关项目开发

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

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

alirezaashrafi/php-file-cache

Composer 安装命令:

composer require alirezaashrafi/php-file-cache

包简介

Fast key value caching system based on file system (without any databases like Redis or Memcache)

README 文档

README

Fast key value caching system based on file system (without any databases like Redis or Memcache)

Installation

This project using composer.

$ composer require alirezaashrafi/php-file-cache

Usage

After installation, you can use 'Cache' class in your project

use AlirezaAshrafi\Cache;

If class with 'Cache' name already exists you can use AS for rename included class

use AlirezaAshrafi\Cache as FileCache;
  • Initialization parameters are directory and file name
  • First parameter is absolute path of cache directory
  • Second parameter is the file you want to save results
$directory = __DIR__ . '/cache-dir';
$file = 'products';

$cache = new Cache($directory , $file);

// OR

$cache = new Cache(__DIR__ . '/cache-dir' , 'products');
  • Directory hierarchy (path/cache-dir/products)

Set

$cache->set("product-1-name", "Iphone 13");
$cache->set("product-1-description", "Iphone 13 pro max 256G");

Get

$product_name = $cache->get("product-1-name", "default value"); // "Iphone 13"
$product_name = $cache->get("product-2-name", "default value"); // "default value"
  • If cache exists it will return the value ("Iphone 13 pro max")
  • Else if cache not exists default value will return ("default value")

Has

$cache->has("product-1-name"); // TRUE
$cache->has("product-2-name"); // FALSE
  • Has function checks the existence of cache in file and memory
  • True or False are return values of has function

Delete

$cache->delete("product-1-description"); // TRUE

Get ALL

$cache->getAll();

Purge (Delete ALL)

$cache->purgeAll();

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-03-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固