redis-store 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of redis-store might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fdc1ba61b75205e6f17d1bb790c3324d98335abb
4
- data.tar.gz: 95cf5013e84b74ef20e9041c971cce5773411ec3
3
+ metadata.gz: f43972892970b9f94f1e04ac38fc754a503b1896
4
+ data.tar.gz: fda18462ae2aabe2bf7a3df1b0c2fb3f83aef61d
5
5
  SHA512:
6
- metadata.gz: 42f21ac1f963af2a5e96a145672ec97d670dc7bfe94dba63eeda69a1bd37567effb5f2d60a09d4f0871f9ded839318de092b88221189e955dd91191adb20c260
7
- data.tar.gz: 488d11620f6f0c2a8ea615825056c199e0267386d374d9d91891c648fe1420739858c7f75cb3c1afafebabe22fa2ffdb99c7c77b33bd46def781a68709c6f15b
6
+ metadata.gz: 74d6284f5ca7dbcb5f47cc7b851b7421b7faa08ee8fa7a437f78ad2d6f7325ef54f7022db9c405d9e95708af4444ef53ad67ae21eba4c3a157762431e972cc9b
7
+ data.tar.gz: 221b8a496bf165cab7ab25cfd3cb426e222cc11e10faa6f6250dfc9d64ec3c381892498d64def2d2de9ee22ed33deb9d433918b10bb64d185195edb40bb58771
data/.travis.yml CHANGED
@@ -1,4 +1,6 @@
1
1
  language: ruby
2
+ sudo: false
3
+ cache: bundler
2
4
  before_install: gem install bundler
3
5
  script: 'bundle exec rake'
4
6
  rvm:
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Redis stores for Ruby frameworks
2
2
 
3
+ [![Build Status](https://travis-ci.org/redis-store/redis-store.svg?branch=master)](https://travis-ci.org/redis-store/redis-store)
4
+
3
5
  __Redis Store__ provides a full set of stores (*Cache*, *I18n*, *Session*, *HTTP Cache*) for modern Ruby frameworks like: __Ruby on Rails__, __Sinatra__, __Rack__, __Rack::Cache__ and __I18n__. It supports object marshalling, timeouts, single or multiple nodes, and namespaces.
4
6
 
5
7
  Please check the *README* file of each gem for usage and installation guidelines.
@@ -35,7 +37,9 @@ If you are on **Snow Leopard** you have to run `env ARCHFLAGS="-arch x86_64" rub
35
37
 
36
38
  ## Status
37
39
 
38
- [![Gem Version](https://badge.fury.io/rb/redis-store.png)](http://badge.fury.io/rb/redis-store) [![Build Status](https://secure.travis-ci.org/redis-store/redis-store.png?branch=master)](http://travis-ci.org/jodosha/redis-store?branch=master) [![Code Climate](https://codeclimate.com/github/jodosha/redis-store.png)](https://codeclimate.com/github/redis-store/redis-store)
40
+ [![Gem Version](https://badge.fury.io/rb/redis-store.png)](http://badge.fury.io/rb/redis-store)
41
+ [![Build Status](https://secure.travis-ci.org/redis-store/redis-store.png?branch=master)](http://travis-ci.org/redis-store/redis-store?branch=master)
42
+ [![Code Climate](https://codeclimate.com/github/redis-store/redis-store.png)](https://codeclimate.com/github/redis-store/redis-store)
39
43
 
40
44
  ## Copyright
41
45
 
@@ -50,6 +50,7 @@ class Redis
50
50
  if options.key?(:key_prefix) && !options.key?(:namespace)
51
51
  options[:namespace] = options.delete(:key_prefix) # RailsSessionStore
52
52
  end
53
+ options[:raw] = !options[:marshalling]
53
54
  options
54
55
  end
55
56
 
@@ -24,6 +24,16 @@ class Redis
24
24
  end
25
25
  end
26
26
 
27
+ def mset(*args)
28
+ options = args.pop if args.length.odd?
29
+ updates = []
30
+ args.each_slice(2) do |(key, value)|
31
+ updates << encode(key)
32
+ _marshal(value, options) { |v| updates << encode(v) }
33
+ end
34
+ super(*updates)
35
+ end
36
+
27
37
  private
28
38
  def _marshal(val, options)
29
39
  yield marshal?(options) ? Marshal.dump(val) : val
@@ -44,7 +44,7 @@ class Redis
44
44
  end
45
45
 
46
46
  def mget(*keys)
47
- options = keys.pop if keys.last.is_a? Hash
47
+ options = (keys.pop if keys.last.is_a? Hash) || {}
48
48
  if keys.any?
49
49
  # Marshalling gets extended before Namespace does, so we need to pass options further
50
50
  if singleton_class.ancestors.include? Marshalling
@@ -1,5 +1,5 @@
1
1
  class Redis
2
2
  class Store < self
3
- VERSION = '1.2.0'
3
+ VERSION = '1.3.0'
4
4
  end
5
5
  end
@@ -44,6 +44,7 @@ describe "Redis::Store::Factory" do
44
44
  it "allows/disable marshalling" do
45
45
  store = Redis::Store::Factory.create :marshalling => false
46
46
  store.instance_variable_get(:@marshalling).must_equal(false)
47
+ store.instance_variable_get(:@options)[:raw].must_equal(true)
47
48
  end
48
49
 
49
50
  it "should instantiate a Redis::DistributedStore store" do
@@ -23,6 +23,12 @@ describe "Redis::Marshalling" do
23
23
  @store.get("rabbit").must_equal(@white_rabbit)
24
24
  end
25
25
 
26
+ it "marshals on multi set" do
27
+ @store.mset("rabbit", @white_rabbit, "rabbit2", @rabbit)
28
+ @store.get("rabbit").must_equal(@white_rabbit)
29
+ @store.get("rabbit2").must_equal(@rabbit)
30
+ end
31
+
26
32
  if RUBY_VERSION.match /1\.9/
27
33
  it "doesn't unmarshal on get if raw option is true" do
28
34
  @store.get("rabbit", :raw => true).must_equal("\x04\bU:\x0FOpenStruct{\x06:\tnameI\"\nbunny\x06:\x06EF")
@@ -38,6 +44,12 @@ describe "Redis::Marshalling" do
38
44
  @store.get("rabbit", :raw => true).must_equal(%(#<OpenStruct color="white">))
39
45
  end
40
46
 
47
+ it "doesn't marshal multi set if raw option is true" do
48
+ @store.mset("rabbit", @white_rabbit, "rabbit2", @rabbit, :raw => true)
49
+ @store.get("rabbit", :raw => true).must_equal(%(#<OpenStruct color="white">))
50
+ @store.get("rabbit2", :raw => true).must_equal(%(#<OpenStruct name="bunny">))
51
+ end
52
+
41
53
  it "doesn't unmarshal if get returns an empty string" do
42
54
  @store.set "empty_string", ""
43
55
  @store.get("empty_string").must_equal("")
@@ -87,7 +99,9 @@ describe "Redis::Marshalling" do
87
99
 
88
100
  it "doesn't unmarshal on multi get" do
89
101
  @store.set "rabbit2", @white_rabbit
90
- rabbit, rabbit2 = @store.mget "rabbit", "rabbit2"
102
+ rabbits = @store.mget "rabbit", "rabbit2"
103
+ rabbit, rabbit2 = rabbits
104
+ rabbits.length.must_equal(2)
91
105
  rabbit.must_equal(@rabbit)
92
106
  rabbit2.must_equal(@white_rabbit)
93
107
  end
@@ -2,6 +2,6 @@ require 'test_helper'
2
2
 
3
3
  describe Redis::Store::VERSION do
4
4
  it 'returns current version' do
5
- Redis::Store::VERSION.must_equal '1.1.7'
5
+ Redis::Store::VERSION.wont_equal nil
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,111 +1,111 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis-store
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luca Guidi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-06 00:00:00.000000000 Z
11
+ date: 2016-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: '2.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
33
  version: '10'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.3'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.3'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: mocha
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ~>
60
60
  - !ruby/object:Gem::Version
61
61
  version: 0.14.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ~>
67
67
  - !ruby/object:Gem::Version
68
68
  version: 0.14.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: minitest
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ~>
74
74
  - !ruby/object:Gem::Version
75
75
  version: '5'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ~>
81
81
  - !ruby/object:Gem::Version
82
82
  version: '5'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: git
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ~>
88
88
  - !ruby/object:Gem::Version
89
89
  version: '1.2'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ~>
95
95
  - !ruby/object:Gem::Version
96
96
  version: '1.2'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: redis-store-testing
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - '>='
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
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
110
  version: '0'
111
111
  description: Namespaced Rack::Session, Rack::Cache, I18n and cache Redis stores for
@@ -116,8 +116,8 @@ executables: []
116
116
  extensions: []
117
117
  extra_rdoc_files: []
118
118
  files:
119
- - ".gitignore"
120
- - ".travis.yml"
119
+ - .gitignore
120
+ - .travis.yml
121
121
  - CHANGELOG
122
122
  - Gemfile
123
123
  - MIT-LICENSE
@@ -154,17 +154,17 @@ require_paths:
154
154
  - lib
155
155
  required_ruby_version: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - ">="
157
+ - - '>='
158
158
  - !ruby/object:Gem::Version
159
159
  version: '0'
160
160
  required_rubygems_version: !ruby/object:Gem::Requirement
161
161
  requirements:
162
- - - ">="
162
+ - - '>='
163
163
  - !ruby/object:Gem::Version
164
164
  version: '0'
165
165
  requirements: []
166
166
  rubyforge_project: redis-store
167
- rubygems_version: 2.5.1
167
+ rubygems_version: 2.5.2
168
168
  signing_key:
169
169
  specification_version: 4
170
170
  summary: Redis stores for Ruby frameworks