redis 2.2.1 → 2.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/redis/distributed.rb +5 -0
- data/lib/redis/version.rb +1 -1
- data/test/commands_on_hashes_test.rb +0 -12
- data/test/lint/hashes.rb +12 -0
- metadata +18 -26
data/Rakefile
CHANGED
data/lib/redis/distributed.rb
CHANGED
@@ -490,6 +490,11 @@ class Redis
|
|
490
490
|
node_for(key).hset(key, field, value)
|
491
491
|
end
|
492
492
|
|
493
|
+
# Set the value of a hash field, only if the field does not exist.
|
494
|
+
def hsetnx(key, field, value)
|
495
|
+
node_for(key).hsetnx(key, field, value)
|
496
|
+
end
|
497
|
+
|
493
498
|
# Get the value of a hash field.
|
494
499
|
def hget(key, field)
|
495
500
|
node_for(key).hget(key, field)
|
data/lib/redis/version.rb
CHANGED
@@ -8,18 +8,6 @@ end
|
|
8
8
|
|
9
9
|
load './test/lint/hashes.rb'
|
10
10
|
|
11
|
-
test "HSETNX" do |r|
|
12
|
-
r.hset("foo", "f1", "s1")
|
13
|
-
r.hsetnx("foo", "f1", "s2")
|
14
|
-
|
15
|
-
assert "s1" == r.hget("foo", "f1")
|
16
|
-
|
17
|
-
r.del("foo")
|
18
|
-
r.hsetnx("foo", "f1", "s2")
|
19
|
-
|
20
|
-
assert "s2" == r.hget("foo", "f1")
|
21
|
-
end
|
22
|
-
|
23
11
|
test "Mapped HMGET in a pipeline returns plain array" do |r|
|
24
12
|
r.hset("foo", "f1", "s1")
|
25
13
|
r.hset("foo", "f2", "s2")
|
data/test/lint/hashes.rb
CHANGED
@@ -4,6 +4,18 @@ test "HSET and HGET" do |r|
|
|
4
4
|
assert "s1" == r.hget("foo", "f1")
|
5
5
|
end
|
6
6
|
|
7
|
+
test "HSETNX" do |r|
|
8
|
+
r.hset("foo", "f1", "s1")
|
9
|
+
r.hsetnx("foo", "f1", "s2")
|
10
|
+
|
11
|
+
assert "s1" == r.hget("foo", "f1")
|
12
|
+
|
13
|
+
r.del("foo")
|
14
|
+
r.hsetnx("foo", "f1", "s2")
|
15
|
+
|
16
|
+
assert "s2" == r.hget("foo", "f1")
|
17
|
+
end
|
18
|
+
|
7
19
|
test "HDEL" do |r|
|
8
20
|
r.hset("foo", "f1", "s1")
|
9
21
|
|
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.2.2
|
4
5
|
prerelease:
|
5
|
-
version: 2.2.1
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Ezra Zygmuntowicz
|
9
9
|
- Taylor Weibley
|
10
10
|
- Matthew Clark
|
@@ -17,20 +17,15 @@ authors:
|
|
17
17
|
autorequire: redis
|
18
18
|
bindir: bin
|
19
19
|
cert_chain: []
|
20
|
-
|
21
|
-
date: 2011-06-08 00:00:00 -03:00
|
20
|
+
date: 2011-08-04 00:00:00.000000000 -03:00
|
22
21
|
default_executable:
|
23
22
|
dependencies: []
|
24
|
-
|
25
23
|
description: Ruby client library for Redis, the key value storage server
|
26
24
|
email: ez@engineyard.com
|
27
25
|
executables: []
|
28
|
-
|
29
26
|
extensions: []
|
30
|
-
|
31
27
|
extra_rdoc_files: []
|
32
|
-
|
33
|
-
files:
|
28
|
+
files:
|
34
29
|
- .gitignore
|
35
30
|
- CHANGELOG.md
|
36
31
|
- LICENSE
|
@@ -116,32 +111,29 @@ files:
|
|
116
111
|
has_rdoc: true
|
117
112
|
homepage: http://github.com/ezmobius/redis-rb
|
118
113
|
licenses: []
|
119
|
-
|
120
114
|
post_install_message:
|
121
115
|
rdoc_options: []
|
122
|
-
|
123
|
-
require_paths:
|
116
|
+
require_paths:
|
124
117
|
- lib
|
125
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
118
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
126
119
|
none: false
|
127
|
-
requirements:
|
128
|
-
- -
|
129
|
-
- !ruby/object:Gem::Version
|
130
|
-
version:
|
131
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ! '>='
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
124
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
125
|
none: false
|
133
|
-
requirements:
|
134
|
-
- -
|
135
|
-
- !ruby/object:Gem::Version
|
136
|
-
version:
|
126
|
+
requirements:
|
127
|
+
- - ! '>='
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '0'
|
137
130
|
requirements: []
|
138
|
-
|
139
131
|
rubyforge_project: redis-rb
|
140
132
|
rubygems_version: 1.6.2
|
141
133
|
signing_key:
|
142
134
|
specification_version: 3
|
143
135
|
summary: Ruby client library for Redis, the key value storage server
|
144
|
-
test_files:
|
136
|
+
test_files:
|
145
137
|
- test/commands_on_hashes_test.rb
|
146
138
|
- test/commands_on_lists_test.rb
|
147
139
|
- test/commands_on_sets_test.rb
|