(cache-get-or-fetch {:keys [fetch cache-set cache-get]})Tiny helper for the usual 'fetch from cache, and if there's a miss, use fetch function to get the data but also cache it' Options:
cache-get - function to fetch from cache (usally redis), accepts 0 argsfetch - the function to fetch data from a slow resource, accepts 0 argscache-set - the function to store data in cache, receives result of fetch as the only argNote:
You need to ensure that resuls of fetch and cache-get return the same types, e.g. Redis' SET foo 1
will cast 1 as string on read!
Tiny helper for the usual 'fetch from cache, and if there's a miss, use fetch function to get the data but also cache it' Options: - `cache-get` - function to fetch from cache (usally redis), accepts 0 args - `fetch` - the function to fetch data from a slow resource, accepts 0 args - `cache-set` - the function to store data in cache, receives result of `fetch` as the only arg Note: You need to ensure that resuls of `fetch` and `cache-get` return the same types, e.g. Redis' `SET foo 1` will cast 1 as string on read!
(execute this redis-fn+args)Executes single redis command - passed as JDBC-style vector: [:command the rest of args]
Executes single redis command - passed as JDBC-style vector: [:command the rest of args]
(execute-pipeline this redis-fns+args)Executes a series of commands + their args in a pipeline. Commands are a vector of vecs with the commands and their args. Use omega-red.protocol/excute-pipeline to invoke!
Executes a series of commands + their args in a pipeline. Commands are a vector of vecs with the commands and their args. Use omega-red.protocol/excute-pipeline to invoke!
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |