kpicaza / redis-etag-cache
This package helps to implement etag cache.
Installs: 2 495
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- php: >=5.4
- kpicaza/etag-cache: ^0.0.3
- predis/predis: ^1.0
Requires (Dev)
- fzaninotto/faker: ^1.6
- m6web/redis-mock: ~2.0
- phpunit/phpunit: ^4.8
README
Requirements:
This package depends on Predis. See installation instruction at Github repo.
Installation:
composer require kpicaza/redis-etag-cache
Usage:
<?php
use Kpicaza\RedisETagCache\RedisETagGenerator;
use Kpicaza\RedisETagCache\RedisETagCache;
use Predis\Client;
$client = new Client();
$eTagGenerator = new RedisETagGenerator();
$eTag = new RedisETagCache($eTagGenerator);
// Set ETag.
$eTag = $eTag->setETag(sprintf('%s_%s', $method, $uri), $response->getContent());
// Get ETag.
$eTag = $this->cache->getETag(sprintf('%s_%s', $method, $uri))