PHPackages                             php-strict/storable-cache - 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. php-strict/storable-cache

ActiveLibrary[Caching](/categories/caching)

php-strict/storable-cache
=========================

Storable cache store items more than their lifetime, up to time to save.

v1.0.0(6y ago)1781GPL-2.0-or-laterPHPPHP ^7.2

Since Dec 6Pushed 6y ago1 watchersCompare

[ Source](https://github.com/php-strict/storable-cache)[ Packagist](https://packagist.org/packages/php-strict/storable-cache)[ Docs](https://github.com/php-strict/storable-cache)[ RSS](/packages/php-strict-storable-cache/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (2)Versions (2)Used By (1)

Storable Cache
==============

[](#storable-cache)

[![Software License](https://camo.githubusercontent.com/e1514dd3f2095dbf68a0008ae62a631142953ad2e86aa94c504343f2c2c191da/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d47504c2d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.txt)[![Build Status](https://camo.githubusercontent.com/9e7dabe1f3ba7abbb5a9cfada6a0a6a0ccd23135dd5b8c4bcef33da02bc09964/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7068702d7374726963742f73746f7261626c652d63616368652f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/php-strict/storable-cache)[![codecov](https://camo.githubusercontent.com/842876026c08ae2f3ce8bc607db1e27f848ba2e5a6a028eb93ccabe0939d9b12/68747470733a2f2f636f6465636f762e696f2f67682f7068702d7374726963742f73746f7261626c652d63616368652f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/php-strict/storable-cache)[![Codacy Badge](https://camo.githubusercontent.com/654ce079b4fe563533e08d765b33c91ea5d86bc6a7dc5c1d100d849ff4300d3e/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f3336366333633764643130363431626561373662613564326463646664366236)](https://www.codacy.com/app/php-strict/storable-cache?utm_source=github.com&utm_medium=referral&utm_content=php-strict/storable-cache&utm_campaign=Badge_Grade)

Storable cache store items more than their lifetime, up to time to save, and allow use stored items after expiration, in cases, for example, of db overload or errors.

Supported storages:

- arrays (not real storage, only for testing),
- files,
- memcached,
- redis,
- SQLite,
- MySQL (uses main db connection from app).

Requirements
------------

[](#requirements)

- PHP &gt;= 7.2
- [php-strict/config](https://github.com/php-strict/config)

Install
-------

[](#install)

Install with [Composer](http://getcomposer.org):

```
composer require php-strict/storable-cache
```

Usage
-----

[](#usage)

Basic usage:

```
use PhpStrict\Config\Config;
use PhpStrict\StorableCache\StorableCache;

//instance of application configuration class, extending Config
//must provide cacheType property with correct storable cache type
//see PhpStrict\StorableCache\StorageTypes class
$config = new AppConfig();
$config->loadFromFile('config.ini');

//instance of StorableCache
$cache = new StorableCache($config);

//part of generating content method
if ($cache->has('contentKey') && !$cache->expired('contentKey')) {
    return $cache->get('contentKey');
}
//part of generating content method

//saving generated content: key, value, ttl, tts (time to save)
$cache->set('contentKey', $content, 60, 3600);
```

Usage if content generating main process was failed and it is correct to use expired data:

```
use PhpStrict\StorableCache\StorableCache;

//part of generating content method

//generating content failed

if ($cache->has('contentKey')) {
    return $cache->get('contentKey');
}

throw Exception('Generating content failed');
//part of generating content method
```

Tests
-----

[](#tests)

To execute the test suite, you'll need [Codeception](https://codeception.com/).

```
vendor\bin\codecept run
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

2352d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9f404fa292f952ba0429cfe11f608e982e0d9d645f2ac864c53abee7f71dff2b?d=identicon)[enikeishik](/maintainers/enikeishik)

---

Top Contributors

[![enikeishik](https://avatars.githubusercontent.com/u/2239913?v=4)](https://github.com/enikeishik "enikeishik (23 commits)")

---

Tags

cachecache-storagecachingcaching-libraryphpphp-libraryphp7storephpcachestoragestorable

###  Code Quality

TestsCodeception

### Embed Badge

![Health badge](/badges/php-strict-storable-cache/health.svg)

```
[![Health](https://phpackages.com/badges/php-strict-storable-cache/health.svg)](https://phpackages.com/packages/php-strict-storable-cache)
```

###  Alternatives

[awssat/laravel-visits

Laravel Redis visits counter for Eloquent models

975163.6k2](/packages/awssat-laravel-visits)[swayok/alternative-laravel-cache

Replacements for Laravel's redis and file cache stores that properly implement tagging idea. Powered by cache pool implementations provided by http://www.php-cache.com/

202541.1k6](/packages/swayok-alternative-laravel-cache)[alekseykorzun/memcached-wrapper-php

Optimized PHP 5 wrapper for Memcached extension that supports dog-piling, igbinary and local storage

2984.6k1](/packages/alekseykorzun-memcached-wrapper-php)[eftec/cacheone

A Cache library with minimum dependency

103.5k4](/packages/eftec-cacheone)

PHPackages © 2026

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