PHPackages                             anekdotes/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. anekdotes/cache

ActiveLibrary[Caching](/categories/caching)

anekdotes/cache
===============

Allows caching using different drivers

2.0.0(4y ago)1481MITPHPPHP &gt;=7.4.0

Since May 4Pushed 4y ago1 watchersCompare

[ Source](https://github.com/anekdotes/cache)[ Packagist](https://packagist.org/packages/anekdotes/cache)[ RSS](/packages/anekdotes-cache/feed)WikiDiscussions master Synced 2mo ago

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

Anekdotes Cache
===============

[](#anekdotes-cache)

[![Latest Stable Version](https://camo.githubusercontent.com/c33ac56ff1a9aaf79d85f7fd6df7d31f5b92226d3ca8a3c431062071ae2dff22/68747470733a2f2f706f7365722e707567782e6f72672f616e656b646f7465732f63616368652f762f737461626c65)](https://packagist.org/packages/anekdotes/cache)[![Build Status](https://camo.githubusercontent.com/b0ccb10a31776ea14e0a60074280923e936a0ed7307dc637262528f8819681b5/68747470733a2f2f7472617669732d63692e6f72672f616e656b646f7465732f63616368652e737667)](https://travis-ci.org/anekdotes/cache)[![codecov.io](https://camo.githubusercontent.com/5744e3cd274fa0399c710db4615623dd10c16f05b0ca868046a05f3bc6182263/68747470733a2f2f636f6465636f762e696f2f6769746875622f616e656b646f7465732f63616368652f636f7665726167652e7376673f6272616e63683d6d6173746572)](https://codecov.io/github/anekdotes/cache?branch=master)[![StyleCI](https://camo.githubusercontent.com/11b9c89bc37965aa2dc94e7b716db2f843080285cbaa56dc111fd8778b1a3dda/68747470733a2f2f7374796c6563692e696f2f7265706f732f35383035323839372f736869656c643f7374796c653d666c6174)](https://styleci.io/repos/58052897)[![License](https://camo.githubusercontent.com/aa5cd0f4c3c740b7058877bf81cd3a8965abfa01d8dae35b9be294020b853283/68747470733a2f2f706f7365722e707567782e6f72672f616e656b646f7465732f63616368652f6c6963656e7365)](https://packagist.org/packages/anekdotes/cache)[![Total Downloads](https://camo.githubusercontent.com/9f182bfae1815e5df0008a626f26001b98ad3aa5eed322d4a742f49ee372ecfa/68747470733a2f2f706f7365722e707567782e6f72672f616e656b646f7465732f63616368652f646f776e6c6f616473)](https://packagist.org/packages/anekdotes/cache)[![Codacy Badge](https://camo.githubusercontent.com/aa62c40666154e8673e158ddc000c2fca641e3e7b8ea8345d89696ff79363054/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f3664373535623734653666633436366462356437663838353261626630313432)](https://www.codacy.com/app/steve-gagnev4si/cache?utm_source=github.com&utm_medium=referral&utm_content=anekdotes/cache&utm_campaign=Badge_Grade)

Allows caching using different drivers

Installation
------------

[](#installation)

Install via composer into your project:

```
composer require anekdotes/cache

```

Usage
-----

[](#usage)

Declare your Cache object depending on your Driver. After construction, all Cache objects can be manipulated the same way.

```
use Anekdotes\Cache\FileCache;
$path = 'tmp/cache/'; //The slash at the end is IMPORTANT. MAKE SURE YOU HAVE IT!
$cache = new FileCache($path);
$key = 'Toaster';
$value = 'Test';
$minutes = 5;
$cache->set($key, $value, $minutes);
$cache->get('Toaster'); //Returns 'Test' as long as this call is made in a 5 minute time-frame past the previous set call.
$cache->time('Toaster'); //Return the datetime object of when this key has been set
$cache->forget('Toaster');
$cache->has('Toaster'); //Returns false.
```

Notes
-----

[](#notes)

- The ArrayCache driver does not currently analyze expiration time. This means all array cached objects last forever.
- The FileCache driver does not implement the increment and decrement functions. Both functions throw LogicException under this driver.
- Setting a cache's expiration to zero will make it never expire. Using ```$cache-&gt;forever()````does the same thing.
- You can use `$cache->flush()` to remove all data in the cache.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity65

Established project with proven stability

 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

Every ~1015 days

Total

3

Last Release

1632d ago

Major Versions

1.0.1 → 2.0.02021-11-24

PHP version history (2 changes)1.0.0PHP &gt;=5.3.0

2.0.0PHP &gt;=7.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/c0c01657f2fe3df0d9bcc9c813d95e422a8afad61a298654d595be447dc86c58?d=identicon)[anekdotes](/maintainers/anekdotes)

---

Top Contributors

[![Grasseh](https://avatars.githubusercontent.com/u/2159610?v=4)](https://github.com/Grasseh "Grasseh (10 commits)")

---

Tags

arraycachefilestorage

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/anekdotes-cache/health.svg)

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

###  Alternatives

[matomo/cache

PHP caching library based on Doctrine cache

38854.1k4](/packages/matomo-cache)[cache/array-adapter

A PSR-6 cache implementation using a php array. This implementation supports tags

548.3M151](/packages/cache-array-adapter)[lochmueller/staticfilecache

Transparent static file cache solution using mod\_rewrite and mod\_expires. Increase performance for static pages by a factor of 230!!

1311.3M3](/packages/lochmueller-staticfilecache)[vink/nova-cache-card

Manage your application's cache from a handy Laravel Nova dashboard card.

26317.3k1](/packages/vink-nova-cache-card)[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)[bnomei/kirby3-redis-cachedriver

Advanced Redis cache-driver with in-memory store, transactions and preloading

101.7k](/packages/bnomei-kirby3-redis-cachedriver)

PHPackages © 2026

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