Ja... i 2.6 i hvert fald. Du kan gøre dette i et LUA-script og blot få LUA-scriptet til at returnere et tomt resultat. Her bruger den booksleeve-klienten:
const int DB = 0; // any database number
// prime some initial values
conn.Keys.Remove(DB, new[] {"a", "b", "c"});
conn.Strings.Increment(DB, "b");
conn.Strings.Increment(DB, "c");
conn.Strings.Increment(DB, "c");
// run the script, passing "a", "b", "c", "c" to
// increment a & b by 1, c twice
var result = conn.Scripting.Eval(DB,
@"for i,key in ipairs(KEYS) do redis.call('incr', key) end",
new[] { "a", "b", "c", "c"}, // <== aka "KEYS" in the script
null); // <== aka "ARGV" in the script
// check the incremented values
var a = conn.Strings.GetInt64(DB, "a");
var b = conn.Strings.GetInt64(DB, "b");
var c = conn.Strings.GetInt64(DB, "c");
Assert.IsNull(conn.Wait(result), "result");
Assert.AreEqual(1, conn.Wait(a), "a");
Assert.AreEqual(2, conn.Wait(b), "b");
Assert.AreEqual(4, conn.Wait(c), "c");
Eller for at gøre det samme med incrby
, ved at overføre "by"-tallene som argumenter, ændre den midterste del til:
// run the script, passing "a", "b", "c" and 1, 1, 2
// increment a & b by 1, c twice
var result = conn.Scripting.Eval(DB,
@"for i,key in ipairs(KEYS) do redis.call('incrby', key, ARGV[i]) end",
new[] { "a", "b", "c" }, // <== aka "KEYS" in the script
new object[] { 1, 1, 2 }); // <== aka "ARGV" in the script