2017 © Pedro Peláez
 

library cache

image

asgard/cache

  • Friday, May 13, 2016
  • by leyou
  • Repository
  • 1 Watchers
  • 0 Stars
  • 666 Installations
  • PHP
  • 0 Dependents
  • 3 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Cache

Build Status, (*1)

Asgard\Cache is a wrapper for the doctrine cache package. It provides a few additionnal features., (*2)

, (*3)

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., (*4)

composer require asgard/cache 0.*

, (*5)

Usage in the Asgard Framework

The cache is available through the service:, (*6)

$cache = $container['cache'];

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

, (*8)

Usage outside the Asgard Framework

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

, (*9)

Array implementation

You can access the cache like an array :, (*10)

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

, (*11)

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:, (*12)

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

, (*13)

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:, (*14)

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

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

, (*16)

Commands

Clear cache

Clear the cache., (*17)

Usage:, (*18)

php console cc

Contributing

Please submit all issues and pull requests to the asgardphp/asgard repository., (*19)

License

The Asgard framework is open-sourced software licensed under the MIT license, (*20)

The Versions

13/05 2016

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

by Michel Hognerud

13/05 2016

v0.3.1

0.3.1.0

  Sources   Download

MIT

The Requires

 

by Michel Hognerud

12/05 2016

v0.3.0

0.3.0.0

  Sources   Download

MIT

The Requires

 

by Michel Hognerud

13/06 2015

v0.2.0

0.2.0.0

  Sources   Download

MIT

The Requires

 

by Michel Hognerud

09/09 2014

v0.1.0

0.1.0.0

  Sources   Download

MIT

The Requires

 

by Michel Hognerud