germania-kg / cacheserviceprovider
1.0.5
2022-03-30 10:25 UTC
Requires
- php: ^5.6|^7.0
- phpfastcache/phpfastcache: ^5.0|^6.0
- pimple/pimple: ^3.0
- psr/cache: ^1.0
Requires (Dev)
- php-coveralls/php-coveralls: ^2.0
- phpunit/phpunit: ^5.7|^6.0|^7.0
This package is auto-updated.
Last update: 2024-11-29 05:27:15 UTC
README
Pimple Service Provider for creating phpFastCache services
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.
$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:
$ composer test # or $ vendor/bin/phpunit