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 |
Properties
static private int | $cache_lifetime | Cache lifetime |
from ContentFilter |
static private int | $lock_timeout | 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 |
|
static private bool | $lock_bypage | Determine if the cache generation should be locked on a per-page basis. If true, concurrent page versions may be generated without rate interference. |
|
static private bool | $lock_byuserip | 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. |
|
static private int | $lock_cooldown | Time duration (in sections) to deny further search requests after a successful search. |
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
Evaluates the result of the given callback
Details
static Config_ForClass
config()
Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .....).
mixed
stat(string $name)
deprecated
deprecated
Get inherited config value
mixed
uninherited(string $name)
Gets the uninherited value for the given config option
$this
set_stat(string $name, mixed $value)
deprecated
deprecated
Update the config value for a given property
__construct($nestedContentFilter = null)
mixed
getContent(string $key, callable $callback)
Evaluates the result of the given callback