RateLimitFilter
class RateLimitFilter extends ContentFilter (View source)
Provides rate limiting of execution of a callback
Traits
Provides extensions to this object to integrate it with standard config API methods.
Constants
CACHE_PREFIX |
Cache key prefix |
Config options
cache_lifetime | int | Cache lifetime |
from ContentFilter |
lock_timeout | int | Time duration (in second) to allow for generation of cached results. Requests to pages that within this time period that do not hit the cache (and would otherwise trigger a version query) will be presented with a 429 (rate limit) HTTP error |
|
lock_bypage | bool | Determine if the cache generation should be locked on a per-page basis. If true, concurrent page versions may be generated without rate interference. |
|
lock_byuserip | bool | Determine if rate limiting should be applied independently to each IP address. This method is not reliable, as most DDoS attacks use multiple IP addresses. |
|
lock_cooldown | int | Time duration (in sections) to deny further search requests after a successful search. |
Properties
protected | ContentFilter | $nestedContentFilter | Nested content filter |
from ContentFilter |
Methods
Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .....).
Gets the uninherited value for the given config option
Details
static Config_ForClass
config()
Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .....).
mixed
uninherited(string $name)
Gets the uninherited value for the given config option
__construct($nestedContentFilter = null)
No description
protected CacheInterface
getCache()
Gets the cache to use
mixed
getContent(string $key, callable $callback)
Evaluates the result of the given callback
protected string
getCacheKey(string $itemkey)
Determines the key to use for saving the current rate