Drupal is a registered trademark of Dries Buytaert
drupal 10.6.11 Update released for Drupal core (10.6.11)! drupal 11.3.12 Update released for Drupal core (11.3.12)! drupal 11.2.14 Update released for Drupal core (11.2.14)! drupal 10.5.12 Update released for Drupal core (10.5.12)! cms 2.1.3 Update released for Drupal core (2.1.3)! drupal 10.5.11 Update released for Drupal core (10.5.11)! drupal 11.3.11 Update released for Drupal core (11.3.11)! drupal 11.2.13 Update released for Drupal core (11.2.13)! drupal 10.6.10 Update released for Drupal core (10.6.10)! cms 2.1.2 Update released for Drupal core (2.1.2)! drupal 11.1.10 Update released for Drupal core (11.1.10)! drupal 10.5.10 Update released for Drupal core (10.5.10)! drupal 10.4.10 Update released for Drupal core (10.4.10)! drupal 11.2.12 Update released for Drupal core (11.2.12)! drupal 11.3.10 Update released for Drupal core (11.3.10)! drupal 10.6.9 Update released for Drupal core (10.6.9)! drupal 10.6.8 Update released for Drupal core (10.6.8)! drupal 11.3.9 Update released for Drupal core (11.3.9)! drupal 11.3.8 Update released for Drupal core (11.3.8)! drupal 11.3.7 Update released for Drupal core (11.3.7)!

guzzle_cache

183 sites Security covered
View on drupal.org

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/');

Activity

Total releases
1
First release
Jun 2026
Latest release
1 day ago
Release cadence
Stability
100% stable

Releases

Version Type Release date
3.1.0 Stable Jun 22, 2026