mon-suivi-logement / sellsy-api-v1-cache-strategy
A cache strategy for Sellsy Api v1, build on top of Kevinrob Guzzle caceh middleware
Installs: 540
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/mon-suivi-logement/sellsy-api-v1-cache-strategy
Requires
README
Sellsy Api V1 cache strategy for Kevinrob Guzzle cache middleware https://github.com/Kevinrob/guzzle-cache-middleware
Installation
composer require mon-suivi-logement/sellsy-api-v1-cache-strategy
or add it the your composer.json and run composer update.
How?
Example with LaravelCacheStorage :
use GuzzleHttp\Client; use GuzzleHttp\HandlerStack; use Kevinrob\GuzzleCache\CacheMiddleware; use Kevinrob\GuzzleCache\Storage\FlysystemStorage; use Kevinrob\GuzzleCache\Storage\LaravelCacheStorage; use MonSuiviLogement\GuzzleCache\Strategy\SellsyApiV1Strategy; $stack = HandlerStack::create(); $cache_middleware = new CacheMiddleware( new SellsyApiV1Strategy( new LaravelCacheStorage( Cache::store('file') ), 1800, // the TTL in seconds ), ); //Allow POST methods on middleware $cache_middleware->setHttpMethods(['GET' => true, 'POST' => true]); $stack->push($cache_middleware,'sellsy-cache'); $guzzle_client = new Client(["handler" => $stack]); $transport_bridge = new Guzzle6($guzzle_client);