tedivm/stash
Composer 安装命令:
composer require tedivm/stash
包简介
The place to keep your cache.
README 文档
README
Stash makes it easy to speed up your code by caching the results of expensive functions or code. Certain actions, like database queries or calls to external APIs, take a lot of time to run but tend to have the same results over short periods of time. This makes it much more efficient to store the results and call them back up later.
Installing
Installing Stash can be done through a variety of methods, although Composer is recommended.
Composer
Until Stash reaches a stable API with version 1.0 it is recommended that you review changes before Minor updates, although bug fixes will always be backwards compatible.
"require": { "tedivm/stash": "0.17.*" }
or by using the composer require command:
composer require tedivm/stash
Github
Releases of Stash are available on Github.
Documentation
Although this README contains some useful data there is a lot more information at the main site, stashphp.com.
Core Concepts
Main Classes
Stash has three main components: a Pool class that represents a specific
grouping of cached objects, an Item class that provides access to individual
objects, and a series of Driver classes that allow Stash to interact with
caching systems.
Each Driver is initialized and then passed into a Pool, at which point the
developer can simply forget about it. Developers also have the option of using
multiple Drivers together by joining them with the Composite Driver.
The Pool class allows developers to perform a number of tasks. There are a few
maintenance related tasks, such as running a "Purge" to allow backend systems to
perform maintenance tasks or set new logging or driver classes. The Pool also
can be used to create Item objects, singly or in groups.
Each Item represents a single object inside the cache. It has a unique Key,
meaning that any two Items created from the same Pool will contain the same
Value. An Item can set, get and remove a value from a caching system.
Keys
A Key is a string that represents an Item in a caching system. At its simplest, a key is an alphanumeric string and has a one to one relationship with a value in the cache.
Stash provides a feature known as "stacks" that allows developers to group related Items together so they can be erased as a group. This is done by giving Items a nested structure, similar to folders on a computer. Just like with folders, this is represented by adding slashes to the name representing the file or cached object.
For example, a Key like "/models/users/34/profile" can allow developers to clear the data for specific users using that user's id, or clear the data for all users or even all models. It can also allow that developer to break up data into specific pieces to only load what is needed.
Session Storage
The provided Session class takes a Pool in its constructor and can then be registered as a Session Handler using the built-in PHP methods, the Session::registerHandler static function, or by using any framework that uses the SessionHandlerInterface interface.
Drivers
Stash currently supports the following backends:
- FileSystem
- Sqlite
- APC
- Memcached
- Redis
- Ephemeral (runtime only)
Stash also supports a specialized "Composite" Driver which can contain any number of the above drivers. This allows developers to created multi-tiered drivers that use a variety of back ends.
Symfony Integration
The Stash Bundle makes using Stash inside of Symfony projects significantly easier. This bundle exposes Stash as a Service for developers to use, and allows Symfony to use Stash as a session handler.
License
Stash is licensed under the BSD License. See the LICENSE file for details.
Reporting Security and Vulnerability Issues
This project utilizes the Tidelift Security Reporting System for security and vulnerability reporting.
Support
Issues can be opened directly in Github for issues that aren't related to security.
Professionally supported Stash is now available with Tidelift.
tedivm/stash 适用场景与选型建议
tedivm/stash 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.9M 次下载、GitHub Stars 达 961, 最近一次更新时间为 2012 年 02 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「redis」 「cache」 「apc」 「caching」 「memcached」 「sessions」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 tedivm/stash 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 tedivm/stash 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 tedivm/stash 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
repository php library
Microservice RPC through message queues.
The CodeIgniter Redis package
Pop Cache Component for Pop PHP Framework
贝嘟分布式缓存扩展
Laravel 5 - Repositories to the database layer
统计信息
- 总下载量: 4.9M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 981
- 点击次数: 44
- 依赖项目数: 145
- 推荐数: 21
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2012-02-19