A colleague and I were using Jedis and wanted to delete multiple keys at once
without using a loop. The version of Jedis we were using has 2 del
functions and the one we wanted use is a java
vararg function and can be found here.
We understood a Java vararg function as a variadic function in Clojure which simply means a function with infinite arity.
Assuming b1
and a1
are keys in redis, the following is what we attempted initially:
(.del jedis "a1" "b1")
The above failed with the following error:
IllegalArgumentException No matching method found: del for class redis.clients.jedis.Jedis clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:80)
A little bit of research lead us to stackoverflow and the first
solution of using into-array
fixed it for us.
We went ahead and tried the following and it worked for us
(.del jedis (into-array ["a1" "b1"]))