redis-objects 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4c3ed8e9d16f4beddbb3e7192845ba17a8367bdb
4
- data.tar.gz: 834245d36db41b311e29d9c2cdce0a7ab02a14e1
3
+ metadata.gz: db06e487bea5d7ea6fe9524c0309fe4bac4c959a
4
+ data.tar.gz: 332266c573fa0b396ecd35b1f95c0923e9e2a8a7
5
5
  SHA512:
6
- metadata.gz: 446c36a59eed213a54d2c73479096b1ffb1cb778cef1f40a1a42ce9bc7e773abe13251a78976b75b15387247f1f28cf8cb8708131608340b27e71e239aa4b191
7
- data.tar.gz: 47626977f71544038bb1a9d3ef0261e126ca804a21c798c6efcca297d8d4b7d012f3ff9701f479d2339f2ceb4b4e5499553814b1d8bba4da0ce72aec030f6190
6
+ metadata.gz: e9440f03a1c478a8f0fd4fdb15a22ddab2656ae315210b235cc31d0bed929aff90ec06afb8b93f9bd68253bdabbf115dd14bee8e14504e648682d7e870940d68
7
+ data.tar.gz: 0fa8ff012020af2740020fcc58d86473ffe8deed5fe487cd546d4007c86666b0642720fe0d703fc343905a3853fc5a9256ecaca29ba0302de5dfd105b377df6b
data/README.md CHANGED
@@ -289,7 +289,7 @@ You can bound the size of the list to only hold N elements like so:
289
289
  @list = Redis::List.new('list_name', :maxlength => 10)
290
290
  ~~~
291
291
 
292
- Complex data types are now handled with :marshal => true:
292
+ Complex data types are serialized with :marshal => true:
293
293
 
294
294
  ~~~ruby
295
295
  @list = Redis::List.new('list_name', :marshal => true)
@@ -300,6 +300,8 @@ Complex data types are now handled with :marshal => true:
300
300
  end
301
301
  ~~~
302
302
 
303
+ Note: If you run into issues, with Marshal errors, refer to the fix in [Issue #176](https://github.com/nateware/redis-objects/issues/176).
304
+
303
305
  Hashes
304
306
  ------
305
307
  Hashes work like a Ruby [Hash](http://ruby-doc.org/core/classes/Hash.html), with
data/Rakefile CHANGED
@@ -5,6 +5,7 @@ task :test do
5
5
  sh "bacon spec/*_spec.rb"
6
6
  end
7
7
  task :default => :test
8
+ task :spec => :test
8
9
 
9
10
  desc "show changelog"
10
11
  task :changelog do
@@ -23,7 +23,9 @@ class Redis
23
23
  end
24
24
 
25
25
  def allow_expiration(&block)
26
- block.call.tap { set_expiration }
26
+ result = block.call
27
+ set_expiration
28
+ result
27
29
  end
28
30
  end
29
31
  end
@@ -118,7 +118,7 @@ class Redis
118
118
 
119
119
  # Set keys in bulk if they do not exist. Takes a hash of field/values {'field1' => 'val1'}. Redis: HSETNX
120
120
  def fill(pairs={})
121
- raise ArgumentError, "Arugment to fill must be a hash of key/value pairs" unless pairs.is_a?(::Hash)
121
+ raise ArgumentError, "Argument to fill must be a hash of key/value pairs" unless pairs.is_a?(::Hash)
122
122
  allow_expiration do
123
123
  pairs.each do |field, value|
124
124
  redis.hsetnx(key, field, marshal(value, options[:marshal_keys][field]))
@@ -28,7 +28,7 @@ class Redis
28
28
  # set :player_ids
29
29
  # end
30
30
  #
31
- # The, you can use these counters both for bookeeping and as atomic actions:
31
+ # The, you can use these counters both for bookkeeping and as atomic actions:
32
32
  #
33
33
  # @game = Game.find(id)
34
34
  # @game_user = @game.joined_players.increment do |val|
@@ -1,5 +1,5 @@
1
1
  class Redis
2
2
  module Objects
3
- VERSION = "1.2.0"
3
+ VERSION = "1.2.1"
4
4
  end
5
5
  end
@@ -39,7 +39,9 @@ class Redis
39
39
  # Adds the specified values to the set. Only works on redis > 2.4
40
40
  # Redis: SADD
41
41
  def merge(*values)
42
- redis.sadd(key, values.flatten.map{|v| marshal(v)})
42
+ allow_expiration do
43
+ redis.sadd(key, values.flatten.map{|v| marshal(v)})
44
+ end
43
45
  end
44
46
 
45
47
  # Return all members in the set. Redis: SMEMBERS
@@ -240,4 +240,15 @@ describe 'Connection tests' do
240
240
  # Fix for future tests
241
241
  Redis.current = @redis_handle
242
242
  end
243
+
244
+ it "should support pipelined changes" do
245
+ list = Redis::List.new('pipelined/list')
246
+ key = Redis::HashKey.new('pipelined/hash')
247
+ Redis::Objects.redis.pipelined do
248
+ key['foo'] = 'bar'
249
+ list.push 1, 2
250
+ end
251
+ key.all.should == { 'foo' => 'bar' }
252
+ list.values.should == %w[1 2]
253
+ end
243
254
  end
@@ -1035,7 +1035,7 @@ describe Redis::Set do
1035
1035
  end
1036
1036
 
1037
1037
  describe "with expiration" do
1038
- [:<<, :add].each do |meth|
1038
+ [:<<, :add, :merge].each do |meth|
1039
1039
  it "should set time to live in seconds when expiration option assigned" do
1040
1040
  @set = Redis::Set.new('spec/set', :expiration => 10)
1041
1041
  @set.send(meth, 'val')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis-objects
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nate Wiger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-01 00:00:00.000000000 Z
11
+ date: 2015-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '3.2'
103
+ version: '4.2'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '3.2'
110
+ version: '4.2'
111
111
  description: Map Redis types directly to Ruby objects. Works with any class or ORM.
112
112
  email:
113
113
  - nwiger@gmail.com
@@ -171,7 +171,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
171
171
  version: '0'
172
172
  requirements: []
173
173
  rubyforge_project:
174
- rubygems_version: 2.2.2
174
+ rubygems_version: 2.4.5
175
175
  signing_key:
176
176
  specification_version: 4
177
177
  summary: Map Redis types directly to Ruby objects