Skip to content

Update

Compare
Choose a tag to compare
@timopruesse timopruesse released this 31 May 18:20
· 165 commits to master since this release

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 use Cacheable for a parent class.
    This will give a good head start, see ForceCache and Cache 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