A store that counts rate limits as a sliding window or with the generic
cell rate algorithm, in one atomic step on the server's clock
(daravel_redis). resetIn is how long until the key holds no hits;
retryAfter how long until a refused hit would be counted.
- Implemented types
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scope → StateScope
-
Where the values live: one isolate, the process, or the cluster.
no setterinherited
Methods
-
acquireLock(
String name, String owner, Duration ttl) → Future< bool> -
Takes the lock
nameforownerduringttl; returns whether it was free.inherited -
add(
String key, Object? value, {Duration? ttl}) → Future< bool> -
Stores only when
keyis absent (atomic per store scope).inherited -
decrement(
String key, [int by = 1]) → Future< int> -
Subtracts
byfrom the integer underkeyand returns the new value.inherited -
flush(
) → Future< void> -
Removes every value.
inherited
-
forceReleaseLock(
String name) → Future< void> -
Releases the lock
namewhoever holds it.inherited -
forever(
String key, Object? value) → Future< void> -
Stores
valueunderkeywith no expiry.inherited -
forget(
String key) → Future< bool> -
Removes
key; returns whether it existed.inherited -
get(
String key) → Future< Object?> -
The value of
key, or null.inherited -
hitGcra(
String key, int maxHits, Duration window) → Future< ({bool allowed, int remaining, Duration resetIn, Duration retryAfter})> -
Counts a hit of
keywith the generic cell rate algorithm. -
hitSlidingWindow(
String key, int maxHits, Duration window) → Future< ({bool allowed, int remaining, Duration resetIn, Duration retryAfter})> -
Counts a hit of
keyin a sliding window ofmaxHitsperwindow. -
increment(
String key, [int by = 1]) → Future< int> -
Adds
byto the integer underkeyand returns the new value.inherited -
lockOwner(
String name) → Future< String?> -
The owner of the lock
name, or null when it is free.inherited -
many(
List< String> keys) → Future<Map< String, Object?> > -
The values of
keys, null for the missing ones.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
put(
String key, Object? value, {Duration? ttl}) → Future< void> -
Stores
valueforttl(null= forever).inherited -
putMany(
Map< String, Object?> values, {Duration? ttl}) → Future<void> -
Stores every entry of
values, forttlor forever.inherited -
releaseLock(
String name, String owner) → Future< bool> -
Releases the lock
nameifownerholds it; returns whether it did.inherited -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited