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-08-29 04:25:43 UTC
README
Pimple 服务提供者 用于创建 phpFastCache 服务
使用 Composer 安装
$ composer require germania-kg/cacheserviceprovider
设置
<?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 );
服务
Cache.ItemPool
返回一个 phpFastCache 实例。
$itempool = $dic['Cache.ItemPool'];
开发
$ git clone https://github.com/GermaniaKG/CacheServiceProvider.git
$ cd CacheServiceProvider
$ composer install
单元测试
可以将 phpunit.xml.dist
复制到 phpunit.xml
并根据您的需要进行调整,或者保持原样。运行 PhpUnit 测试或 composer 脚本如下:
$ composer test # or $ vendor/bin/phpunit