rnr1721/le7-cache-memcache
Composer 安装命令:
composer require rnr1721/le7-cache-memcache
包简介
PSR-16 Memcache adapter for Le7 framework or any other PHP projects
README 文档
README
It make enable to use memcache or memcached with le7-framework or any PHP project
Requirements
- PHP 8.1 or higher.
- Composer 2.0 or higher.
What it can?
- Standard implementation of PSR-16 Simple Cache
- Out of the box can use Filesystem, memory and session adapters
- Use memcache and memcached for caching
Installation
composer require rnr1721/le7-cache-memcache
Testing
composer test
How it works?
use Core\Cache\SCFactoryMemcacheGeneric; $cacheFactory = new SCFactoryMemcacheGeneric(); // For memcache $cache = $cacheFactory->getMemcache("127.0.0.1", 11211); // For memcached $cache = $cacheFactory->getMemcached("127.0.0.1", 11211); $data = [ 'value1' => 'The 1 value', 'value2' => 'The 2 value' ]; // Put data in cache // Set cache key, value and time-to-live $cache->set('mykey', $data, 5000); // Get value from cache $result = $cache->get('mykey'); print_r($result);
implemented methods
use Psr\SimpleCache\CacheInterface; public function get(string $key, mixed $default = null): mixed; public function set(string $key, mixed $value, null|int|DateInterval $ttl = null): bool; public function delete(string $key): bool; public function clear(): bool; public function getMultiple(iterable $keys, mixed $default = null): iterable; public function setMultiple(iterable $values, null|int|\DateInterval $ttl = null): bool; public function deleteMultiple(iterable $keys): bool; public function has(string $key): bool;
factory methods
use Core\Cache\Interfaces\SCFactoryMemcache; /** * Get memcache instance of SimpleCache * @param string $host Memcache host * @param int $port Memcache port * @return CacheInterface */ public function getMemcache(string $host = "127.0.0.1", int $port = 11211): CacheInterface; /** * Get memcached instance of SimpleCache * @param string $host Memcached host * @param int $port Memcached port * @return CacheInterface */ public function getMemcached(string $host = "127.0.0.1", int $port = 11211): CacheInterface;
rnr1721/le7-cache-memcache 适用场景与选型建议
rnr1721/le7-cache-memcache 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 03 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「framework」 「memcache」 「view」 「memcached」 「component」 「le7」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 rnr1721/le7-cache-memcache 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 rnr1721/le7-cache-memcache 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 rnr1721/le7-cache-memcache 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP Framework HLEB2 is the foundation of the web application. Provides ease of development and application performance.
Shoot aims to make providing data to your templates more manageable
Simple to use mutex implementation that can use flock, memcache, memcached, mysql or redis for locking
Graphic stand-alone administration for memcached to monitor and debug purpose
Pop Cache Component for Pop PHP Framework
Illuminate View for Morningmedley.
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 18
- 依赖项目数: 0
- 推荐数: 1
其他信息
- 授权协议: MIT
- 更新时间: 2023-03-17