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

static Config_ForClass
config()

Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .....).

mixed
stat(string $name) 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

Update the config value for a given property

__construct($nestedContentFilter = null)

No description

mixed
getContent(string $key, callable $callback)

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, .....).

Return Value

Config_ForClass

mixed stat(string $name) deprecated

deprecated 5.0 Use ->config()->get() instead

Get inherited config value

Parameters

string $name

Return Value

mixed

mixed uninherited(string $name)

Gets the uninherited value for the given config option

Parameters

string $name

Return Value

mixed

$this set_stat(string $name, mixed $value) deprecated

deprecated 5.0 Use ->config()->set() instead

Update the config value for a given property

Parameters

string $name
mixed $value

Return Value

$this

__construct($nestedContentFilter = null)

Parameters

$nestedContentFilter

mixed getContent(string $key, callable $callback)

Evaluates the result of the given callback

Parameters

string $key

Unique key for this

callable $callback

Callback for evaluating the content

Return Value

mixed

Result of $callback()