PHPackages                             rodchyn/stash - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Caching](/categories/caching)
4. /
5. rodchyn/stash

ActiveLibrary[Caching](/categories/caching)

rodchyn/stash
=============

The place to keep your cache.

v0.14.1(10y ago)0322BSD-3-ClausePHPPHP ^5.4|^7.0

Since Mar 9Pushed 10y ago1 watchersCompare

[ Source](https://github.com/rodchyn/Stash)[ Packagist](https://packagist.org/packages/rodchyn/stash)[ Docs](http://github.com/tedious/Stash)[ RSS](/packages/rodchyn-stash/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (4)Versions (21)Used By (0)

Stash - A PHP Caching Library [![Build Status](https://camo.githubusercontent.com/b76e9b9afd64e0685c1071d939b03f79c7d14f6ec543e0a6ce032406b26fe4a3/68747470733a2f2f7472617669732d63692e6f72672f746564696f75732f53746173682e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/tedious/Stash)
====================================================================================================================================================================================================================================================================================================

[](#stash---a-php-caching-library-)

[![License](https://camo.githubusercontent.com/85a956c28c2082c989dd357697e0e26188ea940f63db90848fb8d36d9b678350/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f74656469766d2f73746173682e737667)](https://github.com/tedious/Stash/blob/master/LICENSE)[![Latest Stable Version](https://camo.githubusercontent.com/8905cae8d82c2609c847662bfc1721da98713ae1d9b3be7f0f6b2572be72a816/687474703a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f746564696f75732f73746173682e737667)](https://packagist.org/packages/tedivm/stash)[![Coverage Status](https://camo.githubusercontent.com/fce531b0c2301f1a414370f340c40ff3c9f90efe6d9fdaae316277fc58bddcf7/687474703a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f746564696f75732f53746173682e737667)](https://coveralls.io/r/tedious/Stash?branch=master)[![Total Downloads](https://camo.githubusercontent.com/0fcb203e60f224c486ff6955f384968e1067286b9a0bc8684e68d382df37b534/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f74656469766d2f73746173682e737667)](https://packagist.org/packages/tedivm/stash)

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)

Installing Stash can be done through a variety of methods, although Composer is recommended.

### Composer

[](#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.14.*"
}

```

### Github

[](#github)

Releases of Stash are available on [Github](https://github.com/tedious/Stash/releases).

Documentation
-------------

[](#documentation)

Although this README contains some useful data there is a lot more information at the main site, [stashphp.com](http://www.stashphp.com/).

Core Concepts
-------------

[](#core-concepts)

### Main Classes

[](#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

[](#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

[](#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
-------

[](#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
-------------------

[](#symfony-integration)

The [Stash Bundle](https://github.com/tedious/TedivmStashBundle) 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
-------

[](#license)

Stash is licensed under the BSD License. See the LICENSE file for details.

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 81.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~84 days

Recently: every ~107 days

Total

18

Last Release

3792d ago

PHP version history (3 changes)v0.9.5PHP &gt;=5.3.0

v0.13.1PHP &gt;=5.4.0

v0.13.2PHP ^5.4|^7.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/209245?v=4)[Yura Rodchyn](/maintainers/rodchyn)[@rodchyn](https://github.com/rodchyn)

---

Top Contributors

[![tedivm](https://avatars.githubusercontent.com/u/121709?v=4)](https://github.com/tedivm "tedivm (571 commits)")[![kbond](https://avatars.githubusercontent.com/u/127811?v=4)](https://github.com/kbond "kbond (32 commits)")[![jhallbachner](https://avatars.githubusercontent.com/u/910695?v=4)](https://github.com/jhallbachner "jhallbachner (27 commits)")[![davereid](https://avatars.githubusercontent.com/u/62967?v=4)](https://github.com/davereid "davereid (13 commits)")[![lstrojny](https://avatars.githubusercontent.com/u/79707?v=4)](https://github.com/lstrojny "lstrojny (6 commits)")[![jonmchan](https://avatars.githubusercontent.com/u/1827190?v=4)](https://github.com/jonmchan "jonmchan (5 commits)")[![pwhelan](https://avatars.githubusercontent.com/u/601645?v=4)](https://github.com/pwhelan "pwhelan (5 commits)")[![CMCDragonkai](https://avatars.githubusercontent.com/u/640797?v=4)](https://github.com/CMCDragonkai "CMCDragonkai (5 commits)")[![localheinz](https://avatars.githubusercontent.com/u/605483?v=4)](https://github.com/localheinz "localheinz (3 commits)")[![mrclay](https://avatars.githubusercontent.com/u/170687?v=4)](https://github.com/mrclay "mrclay (3 commits)")[![icio](https://avatars.githubusercontent.com/u/408401?v=4)](https://github.com/icio "icio (3 commits)")[![andrerom](https://avatars.githubusercontent.com/u/289757?v=4)](https://github.com/andrerom "andrerom (3 commits)")[![vicb](https://avatars.githubusercontent.com/u/248818?v=4)](https://github.com/vicb "vicb (2 commits)")[![lolautruche](https://avatars.githubusercontent.com/u/313528?v=4)](https://github.com/lolautruche "lolautruche (2 commits)")[![pborreli](https://avatars.githubusercontent.com/u/77759?v=4)](https://github.com/pborreli "pborreli (2 commits)")[![rodchyn](https://avatars.githubusercontent.com/u/209245?v=4)](https://github.com/rodchyn "rodchyn (2 commits)")[![staabm](https://avatars.githubusercontent.com/u/120441?v=4)](https://github.com/staabm "staabm (2 commits)")[![ekho](https://avatars.githubusercontent.com/u/273418069?v=4)](https://github.com/ekho "ekho (1 commits)")[![aeoris](https://avatars.githubusercontent.com/u/3284058?v=4)](https://github.com/aeoris "aeoris (1 commits)")[![brutto](https://avatars.githubusercontent.com/u/954379?v=4)](https://github.com/brutto "brutto (1 commits)")

---

Tags

rediscachecachingpsr6psr-6memcachedapcsessions

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rodchyn-stash/health.svg)

```
[![Health](https://phpackages.com/badges/rodchyn-stash/health.svg)](https://phpackages.com/packages/rodchyn-stash)
```

###  Alternatives

[tedivm/stash

The place to keep your cache.

9614.9M126](/packages/tedivm-stash)[symfony/cache

Provides extended PSR-6, PSR-16 (and tags) implementations

4.2k365.0M3.1k](/packages/symfony-cache)[phpfastcache/phpfastcache

PHP Abstract Cache Class - Reduce your database call using cache system. Phpfastcache handles a lot of drivers such as Apc(u), Cassandra, CouchBase, Couchdb, Dynamodb, Firestore, Mongodb, Files, (P)redis, Leveldb, Memcache(d), Ravendb, Ssdb, Sqlite, Wincache, Xcache, Zend Data Cache.

2.4k5.2M137](/packages/phpfastcache-phpfastcache)[tedivm/stash-bundle

Incorporates the Stash caching library into Symfony.

841.4M16](/packages/tedivm-stash-bundle)[matthiasmullie/scrapbook

Scrapbook is a PHP cache library, with adapters for e.g. Memcached, Redis, Couchbase, APCu, SQL and additional capabilities (e.g. transactions, stampede protection) built on top.

3232.7M42](/packages/matthiasmullie-scrapbook)[apix/cache

A thin PSR-6 cache wrapper with a generic interface to various caching backends emphasising cache taggging and indexing to Redis, Memcached, PDO/SQL, APC and other adapters.

114546.3k6](/packages/apix-cache)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
