CredisStorage
in package
implements
StorageInterface
Credis storage adapter for Rate Limiter.
Tags
Interfaces, Classes, Traits and Enums
- StorageInterface
Table of Contents
- $config : array<string|int, mixed>
- $namespace : string
- Cache namespace
- $redis : Credis_Client
- $redisVersion : int
- Redis version
- __construct() : mixed
- Constructor
- delete() : void
- Delete limiter state by ID
- fetch() : LimiterStateInterface|null
- Get limiter state by ID
- save() : void
- Save limiter state
- createRedisKey() : string
- Create a Redis key from a Limiter state ID
Properties
$config
protected
array<string|int, mixed>
$config
= []
$namespace
Cache namespace
protected
string
$namespace
$redis
protected
Credis_Client
$redis
$redisVersion
Redis version
protected
int
$redisVersion
Methods
__construct()
Constructor
public
__construct(Credis_Client $redis[, array<string|int, mixed> $config = [] ]) : mixed
Parameters
- $redis : Credis_Client
-
Redis connection object
- $config : array<string|int, mixed> = []
-
Redis configuration config.ini)
Return values
mixed —delete()
Delete limiter state by ID
public
delete(string $limiterStateId) : void
Parameters
- $limiterStateId : string
-
Limiter state ID
Return values
void —fetch()
Get limiter state by ID
public
fetch(string $limiterStateId) : LimiterStateInterface|null
Parameters
- $limiterStateId : string
-
Limiter state ID
Return values
LimiterStateInterface|null —save()
Save limiter state
public
save(LimiterStateInterface $limiterState) : void
Parameters
- $limiterState : LimiterStateInterface
-
Limiter state
Return values
void —createRedisKey()
Create a Redis key from a Limiter state ID
protected
createRedisKey(string $id) : string
Parameters
- $id : string
-
Limiter state ID