PHPackages                             douglasthwaites/deputy - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Caching](/categories/caching)
4. /
5. douglasthwaites/deputy

ActiveLibrary[Caching](/categories/caching)

douglasthwaites/deputy
======================

Helps Saloon Caching and Rate Limiting play nice.

v1.0.4(1mo ago)03.8k↓50%PHPPHP ^8.3

Since Dec 6Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/DougThwaites/Deputy)[ Packagist](https://packagist.org/packages/douglasthwaites/deputy)[ RSS](/packages/douglasthwaites-deputy/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (8)Versions (5)Used By (0)

Deputy
======

[](#deputy)

Deputy is a [Saloon](saloon) plugin to help with the combination of the official Saloon [Caching](https://docs.saloon.dev/installable-plugins/caching-responses) and [Rate Limit](https://docs.saloon.dev/installable-plugins/handling-rate-limits) plugins.

Both the official Caching and Rate Limit plugins on there own work beautifully and as expected however when combined responses that have been cached will also increment the rate limiter meaning you could only be hitting the cache and throwing a rate limit exception.

This plugin does not override in anyway either of these plugins it works by registering a response middleware that if the request was a cached response it will then decrement the rate limiter by one negating the affects of adding cached responses to the rate limiter.

#### Installation

[](#installation)

```
composer require douglasthwaites/deputy

```

#### Usage

[](#usage)

To use this package add the traits and methods for Rate Limiting and Caching as per the official Saloon docs and then also add the HasRateCache trait to your connector or request.

```
