PHP code example of buzzingpixel / redis-psr-cache-implementation
1. Go to this page and download the library: Download buzzingpixel/redis-psr-cache-implementation library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
buzzingpixel / redis-psr-cache-implementation example snippets
// Create a Redis instance
$redis = new \Redis();
$redis->connect(getenv('REDIS_HOST'));
// Create the RedisCacheItemPool and send it the redis instance
$cacheItemPool = new \BuzzingPixel\RedisCache\RedisCacheItemPool($redis);
$container = new \BuzzingPixel\Container\Container(
bindings: [
\Psr\Cache\CacheItemPoolInterface::class => \BuzzingPixel\RedisCache\RedisCacheItemPool::class,
\Redis::class => static function (): \Redis {
$redis = new \Redis();
$redis->connect(getenv('REDIS_HOST'));
return $redis;
}
]
);