Germania KG · CacheServiceProvider
Pimple Service Provider for creating phpFastCache services, (*1)
, (*2)
Installation with Composer
$ composer require germania-kg/cacheserviceprovider
Setup
<?php
use Germania\CacheServiceProvider\CacheServiceProvider;
// A. Use with Slim or Pimple
$app = new \Slim\App;
$dic = $app->getContainer();
$dic = new Pimple\Container;
// B. Register Service Provider,
// Defaults are unsecure!
$csp = new CacheServiceProvider( );
$csp = new CacheServiceProvider( sys_get_tmp_dir(), 3600);
// Pass custom cache directoy and lifetime (seconds)
$csp = new CacheServiceProvider( "path/to/cache", 3600);
// or, leave at defaults:
$dic->register( $csp );
Services
Cache.ItemPool
Returns a phpFastCache instance., (*3)
$itempool = $dic['Cache.ItemPool'];
Development
$ git clone https://github.com/GermaniaKG/CacheServiceProvider.git
$ cd CacheServiceProvider
$ composer install
Unit tests
Either copy phpunit.xml.dist to phpunit.xml and adapt to your needs, or leave as is. Run PhpUnit test or composer scripts like this:, (*4)
$ composer test
# or
$ vendor/bin/phpunit