redis-scripted 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +7 -3
- data/redis-scripted.gemspec +1 -1
- data/test/rediscripted.rb +14 -0
- metadata +1 -1
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
Redis::Scripted
|
2
2
|
===
|
3
3
|
|
4
4
|
A Ruby client that supports the experimental scripting feature in Redis.
|
@@ -27,8 +27,12 @@ Note that `msadd` receives two arguments at most: one array for the keys
|
|
27
27
|
and another for the values. This is necessary because of [how `EVAL`
|
28
28
|
works](http://antirez.com/post/scripting-branch-released.html).
|
29
29
|
|
30
|
+
The class also exposes the `eval` and `evalsha` methods if you want to
|
31
|
+
call them yourself.
|
32
|
+
|
30
33
|
Acknowledgments
|
31
34
|
===
|
32
35
|
|
33
|
-
Code was inspired by [mkrecny](https://github.com/mkrecny/redis-extend)
|
34
|
-
|
36
|
+
Code was inspired by [mkrecny](https://github.com/mkrecny/redis-extend),
|
37
|
+
[catwell](https://github.com/catwell/redis-extend) and
|
38
|
+
[dsander](https://github.com/dsander/redis-rb/commit/e57d3a08eaef0f98e33cddea90ed317aad4d1f14).
|
data/redis-scripted.gemspec
CHANGED
data/test/rediscripted.rb
CHANGED
@@ -37,3 +37,17 @@ test "uses EVALSHA" do
|
|
37
37
|
|
38
38
|
assert_equal Redis.new(port: 6399).client.call(:evalsha, "d76ce5687840f0436ae4c09c50564cf0e537395e", 2, "foo", "bar"), 1
|
39
39
|
end
|
40
|
+
|
41
|
+
test "EVALSHA" do
|
42
|
+
Redis.new(port: 6399).client.call(:eval, "return #KEYS", 1, "foo")
|
43
|
+
|
44
|
+
assert_equal redis.evalsha(Digest::SHA1.hexdigest("return #KEYS"), ["foo"]), 1
|
45
|
+
end
|
46
|
+
|
47
|
+
test "EVAL" do
|
48
|
+
redis.sadd("foo", "s1")
|
49
|
+
redis.sadd("foo", "s2")
|
50
|
+
redis.sadd("bar", "s1")
|
51
|
+
|
52
|
+
assert_equal redis.eval("return #KEYS", ["foo"]), 1
|
53
|
+
end
|