RateCounterStore class abstract interface

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 name for owner during ttl; returns whether it was free.
inherited
add(String key, Object? value, {Duration? ttl}) → Future<bool>
Stores only when key is absent (atomic per store scope).
inherited
decrement(String key, [int by = 1]) → Future<int>
Subtracts by from the integer under key and returns the new value.
inherited
flush() → Future<void>
Removes every value.
inherited
forceReleaseLock(String name) → Future<void>
Releases the lock name whoever holds it.
inherited
forever(String key, Object? value) → Future<void>
Stores value under key with 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 key with 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 key in a sliding window of maxHits per window.
increment(String key, [int by = 1]) → Future<int>
Adds by to the integer under key and 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 value for ttl (null = forever).
inherited
putMany(Map<String, Object?> values, {Duration? ttl}) → Future<void>
Stores every entry of values, for ttl or forever.
inherited
releaseLock(String name, String owner) → Future<bool>
Releases the lock name if owner holds it; returns whether it did.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited