Module Description
Provides a Drupal cache backend for Kevinrob/guzzle-cache-middleware.

Usage
use GuzzleHttp\Client; use GuzzleHttp\HandlerStack; use Kevinrob\GuzzleCache\CacheMiddleware; use Kevinrob\GuzzleCache\Strategy\PrivateCacheStrategy; use Drupal\guzzle_cache\DrupalGuzzleCache; // Create default HandlerStack $stack = HandlerStack::create(); // Create a Drupal Guzzle cache. Its' useful to have a separate cache bin to // manage independent of other cache bins. Here is how you might define such a // cache bin in a *.service.yml file: // cache.my_custom_http_cache_bin: // class: Drupal\Core\Cache\CacheBackendInterface // tags: // - { name: cache.bin } // factory: cache_factory:get // arguments: [my_custom_http_cache_bin] $cache = new DrupalGuzzleCache(\Drupal::service('cache.my_custom_http_cache_bin')); // Push the cache to the stack. $stack->push( new CacheMiddleware( new PrivateCacheStrategy($cache) ), 'cache' ); // Initialize the client with the handler option $client = new Client(['handler' => $stack]); // Fetch the URI cached if available. $response = $client->request('GET', 'http://www.example.com/');
Project Usage
101
Creation Date
Changed Date
Security Covered
Covered By Security Advisory
Version Available
Production
Module Summary
This module provides a Drupal cache backend for Kevinrob/guzzle-cache-middleware.
Data Name
guzzle_cache

OPENAI CHATBOT

OPENAI CHATBOT

14:35:15
Generic Chatbot
Hi, I'm a Drupal module expert powered by OpenAI, answering your questions about the Drupal module ecosystem. How can I be helpful today? Please note that we will log your question.