承接 byjg/cache-engine 相关项目开发

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

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

byjg/cache-engine

最新稳定版本:6.0.0

Composer 安装命令:

composer require byjg/cache-engine

包简介

A powerful, versatile cache implementation providing both PSR-6 and PSR-16 interfaces with support for multiple storage drivers.

README 文档

README

Sponsor Build Status Opensource ByJG GitHub source GitHub license GitHub release

A powerful, versatile cache implementation providing both PSR-6 and PSR-16 interfaces with support for multiple storage drivers.

Key Features

  • PSR-16 Simple Cache interface - Simple, straightforward caching API
  • PSR-6 Cache Pool interface - More verbose caching with fine-grained control
  • Multiple storage backends - Choose from memory, file system, Redis, Memcached and more
  • Atomic operations - Support for increment, decrement and add operations in compatible engines
  • Garbage collection - Automatic cleanup of expired items
  • PSR-11 container support - Retrieve cache keys via dependency container
  • Logging capabilities - PSR-3 compatible logging of cache operations

Quick Start

composer require "byjg/cache-engine"
// PSR-16 Simple Cache
$cache = new \ByJG\Cache\Psr16\FileSystemCacheEngine();
$cache->set('key', 'value', 3600); // Cache for 1 hour
$value = $cache->get('key');

// PSR-6 Cache Pool
$pool = \ByJG\Cache\Factory::createFilePool();
$item = $pool->getItem('key');
if (!$item->isHit()) {
    $item->set('value');
    $item->expiresAfter(3600);
    $pool->save($item);
}
$value = $item->get();

Documentation

Getting Started

Available Cache Engines

Engine Description
NoCacheEngine No-op engine for disabling cache without code changes
ArrayCacheEngine In-memory array cache (non-persistent between requests)
FileSystemCacheEngine File system based caching
MemcachedEngine Memcached distributed caching
RedisCacheEngine Redis-based caching
SessionCacheEngine PHP session-based caching
TmpfsCacheEngine Tmpfs-based caching
ShmopCacheEngine Shared memory caching (deprecated)
KeyValueCacheEngine S3-Like or CloudflareKV storage (separate package)

Advanced Features

Running Unit Tests

vendor/bin/phpunit --stderr

Note: The --stderr parameter is required for SessionCacheEngine tests to run properly.

Dependencies

flowchart TD
    byjg/cache-engine --> psr/cache
    byjg/cache-engine --> psr/log
    byjg/cache-engine --> psr/simple-cache
    byjg/cache-engine --> psr/container
Loading

Open source ByJG

统计信息

  • 总下载量: 62.91k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 11
  • 点击次数: 1
  • 依赖项目数: 9
  • 推荐数: 2

GitHub 信息

  • Stars: 11
  • Watchers: 1
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-07-21