(local-storage & [backing-atom])
Instantiate a new LocalStorage storage implementation.
Accepts an optional atom wrapping a map. This allows the same atom to be shared by multiple LocalStorage instances.
If an argument is not provided, a new atom will be created.
Instantiate a new LocalStorage storage implementation. Accepts an optional atom wrapping a map. This allows the same atom to be shared by multiple LocalStorage instances. If an argument is not provided, a new atom will be created.
A protocol describing the interface for storage backends.
get-count
is used to read the current counter value for a given key.
increment-count
is used to increment the counter for a given
key. This function is responsible also for creating the counter if
it doesn't exist already, and for scheduling the counter to expire
after the provided delay.
counter-expiry
is used to return a timestamp of when the counter
will expire, ie when the rate limit is reset again.
A protocol describing the interface for storage backends. `get-count` is used to read the current counter value for a given key. `increment-count` is used to increment the counter for a given key. This function is responsible also for creating the counter if it doesn't exist already, and for scheduling the counter to expire after the provided delay. `counter-expiry` is used to return a timestamp of when the counter will expire, ie when the rate limit is reset again.
(clear-counters self)
(counter-expiry self key)
(get-count self key)
(increment-count self key ttl)
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close