honkster-redis-store 0.3.10 → 0.3.11
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -1
- data/Gemfile +4 -3
- data/VERSION +1 -1
- data/lib/cache/sinatra/redis_store.rb +3 -7
- data/lib/{cache/rails/redis_session_store.rb → rack/session/rails.rb} +0 -0
- data/lib/redis-store.rb +3 -1
- data/spec/cache/merb/redis_store_spec.rb +1 -1
- data/spec/cache/rails/redis_store_spec.rb +5 -4
- data/spec/cache/sinatra/redis_store_spec.rb +1 -1
- data/spec/redis/marshaled_redis_spec.rb +1 -1
- data/spec/spec_helper.rb +2 -3
- metadata +3 -3
data/.gitignore
CHANGED
data/Gemfile
CHANGED
@@ -1,13 +1,14 @@
|
|
1
|
+
source :gemcutter
|
1
2
|
gem "redis", "1.0.5"
|
2
3
|
|
3
4
|
# testing gems
|
4
5
|
group :testing do
|
5
6
|
gem "ruby-debug"
|
6
7
|
gem "rspec"
|
7
|
-
gem "rack", "1.
|
8
|
+
gem "rack", "1.0.0"
|
8
9
|
gem "rack-cache"
|
9
|
-
gem "activesupport"
|
10
|
-
gem "actionpack"
|
10
|
+
gem "activesupport", "2.3.5"
|
11
|
+
gem "actionpack", "2.3.5"
|
11
12
|
gem "merb"
|
12
13
|
gem "jeweler"
|
13
14
|
gem "git"
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.11
|
@@ -20,14 +20,10 @@ module Sinatra
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def write(key, value, options = nil)
|
23
|
-
if options
|
24
|
-
|
25
|
-
@data.marshalled_setnx key, value, options
|
26
|
-
else
|
27
|
-
@data.marshalled_set key, value, options
|
28
|
-
end
|
23
|
+
if options && options[:unless_exist]
|
24
|
+
@data.marshalled_setnx key, value, options
|
29
25
|
else
|
30
|
-
@data.marshalled_set key, value
|
26
|
+
@data.marshalled_set key, value, options
|
31
27
|
end
|
32
28
|
end
|
33
29
|
|
File without changes
|
data/lib/redis-store.rb
CHANGED
@@ -13,7 +13,6 @@ elsif defined?(Merb)
|
|
13
13
|
require "cache/merb/redis_store"
|
14
14
|
elsif defined?(Rails)
|
15
15
|
require "cache/rails/redis_store"
|
16
|
-
require "cache/rails/redis_session_store"
|
17
16
|
end
|
18
17
|
|
19
18
|
# Rack::Session
|
@@ -23,6 +22,9 @@ if defined?(Rack::Session)
|
|
23
22
|
if defined?(Merb)
|
24
23
|
require "rack/session/merb"
|
25
24
|
end
|
25
|
+
if defined?(Rails)
|
26
|
+
require "rack/session/rails"
|
27
|
+
end
|
26
28
|
end
|
27
29
|
|
28
30
|
# Rack::Cache
|
@@ -49,7 +49,7 @@ module Merb
|
|
49
49
|
|
50
50
|
it "should read raw data" do
|
51
51
|
with_store_management do |store|
|
52
|
-
store.read("rabbit", {}, :raw => true).should ==
|
52
|
+
store.read("rabbit", {}, :raw => true).should == Marshal.dump(@rabbit)
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
@@ -52,7 +52,7 @@ module ActiveSupport
|
|
52
52
|
it "should write the data with expiration time" do
|
53
53
|
with_store_management do |store|
|
54
54
|
store.write "rabbit", @white_rabbit, :expires_in => 1.second
|
55
|
-
store.read("rabbit").should
|
55
|
+
store.read("rabbit").should == @white_rabbit ; sleep 2
|
56
56
|
store.read("rabbit").should be_nil
|
57
57
|
end
|
58
58
|
end
|
@@ -60,13 +60,13 @@ module ActiveSupport
|
|
60
60
|
it "should not write data if :unless_exist option is true" do
|
61
61
|
with_store_management do |store|
|
62
62
|
store.write "rabbit", @white_rabbit, :unless_exist => true
|
63
|
-
store.read("rabbit").should
|
63
|
+
store.read("rabbit").should == @rabbit
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
67
|
it "should read raw data" do
|
68
68
|
with_store_management do |store|
|
69
|
-
store.read("rabbit", :raw => true).should ==
|
69
|
+
store.read("rabbit", :raw => true).should == Marshal.dump(@rabbit)
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
@@ -149,7 +149,8 @@ module ActiveSupport
|
|
149
149
|
store.fetch("rub-a-dub").should === "Flora de Cana"
|
150
150
|
store.fetch("rabbit", :force => true).should be_nil # force cache miss
|
151
151
|
store.fetch("rabbit", :force => true, :expires_in => 1.second) { @white_rabbit }
|
152
|
-
store.fetch("rabbit").should
|
152
|
+
store.fetch("rabbit").should == @white_rabbit
|
153
|
+
sleep 2
|
153
154
|
store.fetch("rabbit").should be_nil
|
154
155
|
end
|
155
156
|
end
|
@@ -87,7 +87,7 @@ module Sinatra
|
|
87
87
|
|
88
88
|
it "should read raw data" do
|
89
89
|
with_store_management do |store|
|
90
|
-
store.read("rabbit", :raw => true).should ==
|
90
|
+
store.read("rabbit", :raw => true).should == Marshal.dump(@rabbit)
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
@@ -2,7 +2,7 @@ require File.join(File.dirname(__FILE__), "/../spec_helper")
|
|
2
2
|
|
3
3
|
describe "MarshaledRedis" do
|
4
4
|
before(:each) do
|
5
|
-
@store = MarshaledRedis.new
|
5
|
+
@store = ::MarshaledRedis.new
|
6
6
|
@rabbit = OpenStruct.new :name => "bunny"
|
7
7
|
@white_rabbit = OpenStruct.new :color => "white"
|
8
8
|
@store.marshalled_set "rabbit", @rabbit
|
data/spec/spec_helper.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
$:.unshift(File.join(File.dirname(__FILE__), "/../lib"))
|
1
|
+
$:.unshift(File.expand_path(File.join(File.dirname(__FILE__), "/../lib")))
|
2
2
|
ARGV << "-b"
|
3
3
|
require "rubygems"
|
4
4
|
require "bundler"
|
@@ -17,8 +17,7 @@ require "redis-store"
|
|
17
17
|
require "active_support"
|
18
18
|
require "action_controller/session/abstract_store"
|
19
19
|
require "cache/rails/redis_store"
|
20
|
-
require "
|
20
|
+
require "rack/session/rails"
|
21
21
|
require "cache/sinatra/redis_store"
|
22
22
|
|
23
|
-
class Redis; attr_reader :host, :port, :db end
|
24
23
|
$DEBUG = ENV["DEBUG"] === "true"
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 3
|
8
|
-
-
|
9
|
-
version: 0.3.
|
8
|
+
- 11
|
9
|
+
version: 0.3.11
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Luca Guidi
|
@@ -34,12 +34,12 @@ files:
|
|
34
34
|
- Rakefile
|
35
35
|
- VERSION
|
36
36
|
- lib/cache/merb/redis_store.rb
|
37
|
-
- lib/cache/rails/redis_session_store.rb
|
38
37
|
- lib/cache/rails/redis_store.rb
|
39
38
|
- lib/cache/sinatra/redis_store.rb
|
40
39
|
- lib/rack/cache/redis_entitystore.rb
|
41
40
|
- lib/rack/cache/redis_metastore.rb
|
42
41
|
- lib/rack/session/merb.rb
|
42
|
+
- lib/rack/session/rails.rb
|
43
43
|
- lib/rack/session/redis.rb
|
44
44
|
- lib/redis-store.rb
|
45
45
|
- lib/redis/distributed_marshaled_redis.rb
|