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

ActiveLibrary

asgard/cache
============

v0.3.1(10y ago)0699MITPHPPHP &gt;=5.5.9

Since Sep 9Pushed 10y agoCompare

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

READMEChangelog (4)Dependencies (1)Versions (5)Used By (0)

\#Cache

[![Build Status](https://camo.githubusercontent.com/91c456cbdb40e46658adeadecbd9e56e93cb57fd7f3c4cd32f8a55f523811f83/68747470733a2f2f7472617669732d63692e6f72672f6173676172647068702f63616368652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/asgardphp/cache)

Asgard\\Cache is a wrapper for the doctrine cache package. It provides a few additionnal features.

- [Installation](#installation)
- [Usage in the Asgard Framework](#usage-asgard)
- [Usage outside the Asgard Framework](#usage-outside)
- [Array implementation](#array)
- [Default result](#default)
- [NullCache](#nullcache)
- [Commands](#commands)

\##Installation **If you are working on an Asgard project you don't need to install this library as it is already part of the standard libraries.**

```
composer require asgard/cache 0.*

```

\##Usage in the Asgard Framework The cache is available through the service:

```
$cache = $container['cache'];

```

To change, the cache driver in an Asgard application, edit the web/index.php file.

\##Usage outside the Asgard Framework

```
$cache = new \Asgard\Cache\Cache(new \Doctrine\Common\Cache\Cache);

```

\##Array implementation

You can access the cache like an array :

```
$value = $cache['key'];
$cache['key'] => $value;
isset($cache['key']);
unset($cache['key']);

```

\##Default result

If the cache cannot fetch you key, it will return and store the default value. The default value can also be a callback, in which case the result will be returned and stored:

```
$cache->fetch('key', 'default');
#or
$cache->fetch('key', function() {
	return 'default';
})

```

\##NullCache

NullCache lets you use the cache without concern for its activation. The values will not be stored but the code using the cache will be same either way:

```
$cache = new \Asgard\Cache\Cache(new \Asgard\Cache\NullCache());
$res = $cache->fetch('home', function() {
	return 'Home';
});

```

If the cache driver was different, the result would be stored and used the next time the cache is called.

\##Commands

\###Clear cache

Clear the cache.

Usage:

```
php console cc

```

\###Contributing

Please submit all issues and pull requests to the [asgardphp/asgard](http://github.com/asgardphp/asgard) repository.

### License

[](#license)

The Asgard framework is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity51

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

Every ~204 days

Total

4

Last Release

3654d ago

PHP version history (2 changes)v0.1.0PHP &gt;=5.4.0

v0.3.0PHP &gt;=5.5.9

### Community

Maintainers

![](https://www.gravatar.com/avatar/849017ae3ff0c90a272e935f9c1db9a64692db4a2a18a8d0e4bf9dbcd6f74e2c?d=identicon)[leyou](/maintainers/leyou)

---

Top Contributors

[![h0gar](https://avatars.githubusercontent.com/u/439138?v=4)](https://github.com/h0gar "h0gar (36 commits)")

### Embed Badge

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

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

###  Alternatives

[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[contao-community-alliance/dc-general

Universal data container for Contao

1578.3k86](/packages/contao-community-alliance-dc-general)[pdir/social-feed-bundle

Social feed extension for Contao CMS

1414.8k](/packages/pdir-social-feed-bundle)

PHPackages © 2026

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