taoensso / carmine

Redis client + message queue for Clojure
https://www.taoensso.com/carmine
Eclipse Public License 1.0
1.15k stars 130 forks source link

Best way to set multiple keys if I don't care about the return result? #229

Closed theronic closed 4 years ago

theronic commented 4 years ago

What's the fastest way to write a bunch of keys to Redis? Should I do a pmap, mapv, doseq over a vector, separate wcar calls? Pipelining?

ptaoussanis commented 4 years ago

Might depend a little on what you mean by "a bunch" (e.g. if you need laziness). Assuming you don't need laziness, mset is probably your best bet.

You can use Carmine's redis-call command to create a large mset call, e.g.: (wcar {} (redis-call (into [:mset] my-kvs)))).

Otherwise something like a doseq with set calls in a pipeline should also probably be fine.

Hope that helps :-)