Update
Added
-
You can now provide a custom caching strategy instead of being limited to the default ones.
Your custom caching strategy must implement
CacheStrategy
.
It is suggested you useCacheable
for a parent class.
This will give a good head start, seeForceCache
andCache
for ideas.To use your custom caching strategy, you'll need to pass the fully qualified cache name to
RequestLimitRuleset
.$rules = new RequestLimitRuleset([ ... ], MyCustomCacheStrategy::class, 'array', new Repository(...)); $throttle = new ThrottleMiddleware($rules);
Thanks to @LightGuard