redis-session-store 0.2.1 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/redis-session-store.rb +11 -5
  3. metadata +9 -19
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3050f5517fc5247b9d25a33f9f6465d01a3fb53a
4
+ data.tar.gz: 806d6dfc551aa06d49515f179cb8fde40c836df4
5
+ SHA512:
6
+ metadata.gz: 147ff236358fa4bd9fbdb6e59c6e07666eeacc00b89231ef491edcbc0a33e94d1e320db01a8156c9be5a02602b665edea46a2c0637161676ef1d6aecd9c3180b
7
+ data.tar.gz: 426f6b6344b8dfc377e984f93f4d674db76dcc229b54ab5c6db98da152e5fff252edca6e456d2b9fcd7217fc9de66a8c3f8e522c42d43b7eee07ff3cc0a504c2
@@ -31,14 +31,20 @@ class RedisSessionStore < ActionController::Session::AbstractStore
31
31
  end
32
32
 
33
33
  def get_session(env, sid)
34
- sid ||= generate_sid
35
- begin
36
- data = @redis.get(prefixed(sid))
37
- session = data.nil? ? {} : Marshal.load(data)
38
- rescue Errno::ECONNREFUSED
34
+ unless sid && (session = load_session_from_redis(sid))
35
+ sid = generate_sid
39
36
  session = {}
40
37
  end
38
+
41
39
  [sid, session]
40
+ rescue Errno::ECONNREFUSED
41
+ [generate_sid, {}]
42
+ end
43
+
44
+ def load_session_from_redis(sid)
45
+ data = @redis.get(prefixed(sid))
46
+
47
+ data ? Marshal.load(data) : nil
42
48
  end
43
49
 
44
50
  def set_session(env, sid, session_data)
metadata CHANGED
@@ -1,30 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis-session-store
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
5
- prerelease:
4
+ version: 0.2.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Mathias Meyer
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-09-17 00:00:00.000000000 Z
11
+ date: 2014-03-14 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: redis
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  description: A drop-in replacement for e.g. MemCacheStore to store Rails sessions
@@ -50,33 +47,26 @@ files:
50
47
  homepage: https://github.com/roidrage/redis-session-store
51
48
  licenses:
52
49
  - MIT
50
+ metadata: {}
53
51
  post_install_message:
54
52
  rdoc_options: []
55
53
  require_paths:
56
54
  - lib
57
55
  required_ruby_version: !ruby/object:Gem::Requirement
58
- none: false
59
56
  requirements:
60
- - - ! '>='
57
+ - - '>='
61
58
  - !ruby/object:Gem::Version
62
59
  version: '0'
63
- segments:
64
- - 0
65
- hash: 1399082563696074754
66
60
  required_rubygems_version: !ruby/object:Gem::Requirement
67
- none: false
68
61
  requirements:
69
- - - ! '>='
62
+ - - '>='
70
63
  - !ruby/object:Gem::Version
71
64
  version: '0'
72
- segments:
73
- - 0
74
- hash: 1399082563696074754
75
65
  requirements: []
76
66
  rubyforge_project:
77
- rubygems_version: 1.8.23
67
+ rubygems_version: 2.0.14
78
68
  signing_key:
79
- specification_version: 3
69
+ specification_version: 4
80
70
  summary: A drop-in replacement for e.g. MemCacheStore to store Rails sessions (and
81
71
  Rails sessions only) in Redis.
82
72
  test_files: []