FacturaScripts

MultiRequestProtection

Class to prevent duplicated petitions.

Table of Contents

CACHE_KEY 'MultiRequestProtection'
MAX_TOKEN_AGE 4
MAX_TOKENS 500
RANDOM_STRING_LENGTH 6
$cache Cache
$seed string
__construct() mixed
addSeed() mixed
newToken() Generates a random token. string
tokenExist() Validates if a petition token exist, otherwise save it. bool
validate() bool
getRandomStr() string
getTokens() array
saveToken() Saves the new token to cache. bool

Constants

Properties

Methods

addSeed()

public addSeed( $seed : string ) : mixed
Parameters
$seed : string
Return values
mixed

tokenExist()

Validates if a petition token exist, otherwise save it.

public tokenExist( $token : string ) : bool
Parameters
$token : string
Return values
bool

validate()

public validate( $token : string ) : bool
Parameters
$token : string
Return values
bool

saveToken()

Saves the new token to cache.

protected saveToken( $token : string ) : bool
Parameters
$token : string
Return values
bool

Search results