paneidos/laravel-tagged-cache
Composer 安装命令:
composer require paneidos/laravel-tagged-cache
包简介
Force a tag on your cache, allowing you to share memcache instances.
README 文档
README
Laravel Tagged Cache
Force a certain tag on your cache.
Why would I need this?
If you use the same Memcache server for multiple projects/tenants, it might be difficult to flush the cache for only one of them. The only options is to flush the entire cache. Using Laravel's built in TaggableStore, it's possible to flush the cache for only one project/tenant.
How does it work?
The tagged cache driver is a simple wrapper for another cache driver. All regular access to cache keys, such as get, put and remember, are forced to use the tags method and include the specified tag. Other special methods, such as lock are passed through without modification.
Installation
To get started with Laravel Tagged Cache, use Composer to add the package to your project's dependencies:
composer require paneidos/laravel-tagged-cache
Config
Specify a tagged store in your config/cache.php:
return [ 'stores' => [ 'memcache-tagged' => [ 'driver' => 'tagged', 'backend' => 'memcache', 'tag' => 'project_name', ], 'memcache' => [ // ... ], // ... ], ];
Example: replace your default store
return [ 'default' => 'tagged', 'stores' => [ 'tagged' => [ 'driver' => 'tagged', 'backend' => env('CACHE_DRIVER', 'array'), // Use the database name as the forced tag 'tag' => env('DB_DATABASE', 'none'), ], // ... ], ];
Compatibility
Currently works with Laravel 5.6 and higher. The backend can be any store with support for tags. Note: the file store does not support tags.
Development
# Install dependencies
composer install
# Run tests
composer test
# Run tests & report coverage
composer test -- --coverage-text
Contributing
Send a pull request, ensure you've got test coverage for the new code.
License
Laravel Tagged Cache is licensed under the MIT License.
paneidos/laravel-tagged-cache 适用场景与选型建议
paneidos/laravel-tagged-cache 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.22k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 05 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 paneidos/laravel-tagged-cache 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 paneidos/laravel-tagged-cache 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 5.22k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-05-03