dadapas/cache 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

dadapas/cache

Composer 安装命令:

composer require dadapas/cache

包简介

PSR-6 and PSR-16 Implementations

README 文档

README

PHP Cache

This is an implementation of PSR-6 and PSR-16 cache interface,

Installation

Install composer if not and enter the command

composer require dadapas/cache

Basic usage

A basic usage of cache

use Dadapas\Cache\CacheItemPool;
use Dadapas\Cache\CacheItem;
use Dadapas\Cache\FileCacheAdapter;

// Declarations
$adapter   = new FileCacheAdapter(__DIR__."/cache"); // cache adapter
$pool      = new CacheItemPool($adapter);            // pool

$key       = "mykey";
$cacheItem = new CacheItem($key);                    // cache item
// Set the cache value
$cacheItem->set("cache value");
$cacheItem->expiresAfter(3600);                      // cache will live in 1 hour
$pool->save($cache);                                 // Save the cache

// ...

To get a cache from the pool

// Get cache by key null if key not exist
$cacheItem = $pool->getItem($key);

// get the cache value null if expires or non exist key
$cacheItem->get();

// To get the key
$cacheItem->getKey();

// Set the exact expiration date
// This data will expire in 1st january 2023
$cacheItem->expiresAt(new DateTime("2023-01-01"));

// 

You can then pick one of the implementations of the interface to get a logger.

If you want to implement the interface, you can require this package and implement Psr\Cache\CacheItemPoolInterface in the code code. Please read the specification text for details.

Test

For making a test just

composer test

License

The licence is MIT for more details click here

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-06-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固