byjg/cache-engine
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
| sidebar_key | cache-engine | |||
|---|---|---|---|---|
| tags |
|
Cache Engine
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
byjg/cache-engine 适用场景与选型建议
byjg/cache-engine 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 68.16k 次下载、GitHub Stars 达 11, 最近一次更新时间为 2015 年 07 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 byjg/cache-engine 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 byjg/cache-engine 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 68.16k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 11
- 点击次数: 9
- 依赖项目数: 9
- 推荐数: 2
其他信息
- 授权协议: MIT
- 更新时间: 2015-07-21