redis-scripted 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- `Redis::Scripted`
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
- and [catwell](https://github.com/catwell/redis-extend).
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).
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "redis-scripted"
3
- s.version = "0.0.1"
3
+ s.version = "0.0.2"
4
4
  s.summary = "A Ruby client that supports the experimental scripting feature of Redis"
5
5
  s.authors = ["Damian Janowski"]
6
6
  s.email = ["djanowski@dimaion.com"]
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
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: redis-scripted
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.1
5
+ version: 0.0.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Damian Janowski