request_store_rails 0.0.3 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/request_locals.rb +12 -4
- data/lib/request_store_rails/version.rb +1 -1
- metadata +7 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2738ba0a9382c489a0c1f2cf8b3b398d2d4512b2
|
4
|
+
data.tar.gz: 2a04e6524fad9edf05669e4cede924afe6751d3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f6b72e78bcbe9c507dd0c1cba9ad6f481d694cb53662bf03771f69ca5d43ce47119f9e7bbd97181a89e73aceb93859dddf4478be2ef5cb0f6d889fac5478478
|
7
|
+
data.tar.gz: af5a9b6a7f85bb62fe17ea12d20037f035ba30ebac02a04ea27adbe72c7385f5e1e78b7d68d8c2ea63df7af014d99c8465b01010f434301a47c2810c89f02798
|
data/lib/request_locals.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'singleton'
|
2
2
|
require 'forwardable'
|
3
|
-
require '
|
3
|
+
require 'concurrent'
|
4
4
|
|
5
5
|
# Public: Provides per-request global storage, by offering an interface that is
|
6
6
|
# very similar to Rails.cache, or Hash.
|
@@ -27,11 +27,19 @@ class RequestLocals
|
|
27
27
|
private :instance
|
28
28
|
end
|
29
29
|
|
30
|
+
# Internal: Cache that supports nested access by using a monitor instead of a mutex.
|
31
|
+
class Cache < Concurrent::Map
|
32
|
+
def initialize(options = nil)
|
33
|
+
super(options)
|
34
|
+
@write_lock = Monitor.new
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
30
38
|
# Internal: Methods of the RequestLocals instance, delegated to the request-local structure.
|
31
39
|
def_delegators :store, :[], :[]=, :delete, :empty?
|
32
40
|
|
33
41
|
def initialize
|
34
|
-
@cache =
|
42
|
+
@cache = Cache.new
|
35
43
|
end
|
36
44
|
|
37
45
|
# Public: Removes all the request-local variables.
|
@@ -45,7 +53,7 @@ class RequestLocals
|
|
45
53
|
#
|
46
54
|
# Returns nothing.
|
47
55
|
def clear_all!
|
48
|
-
@cache =
|
56
|
+
@cache = Cache.new
|
49
57
|
end
|
50
58
|
|
51
59
|
# Public: Checks if a value was stored for the given key.
|
@@ -84,6 +92,6 @@ protected
|
|
84
92
|
# Internal: Returns a new empty structure where the request-local variables
|
85
93
|
# will be stored.
|
86
94
|
def new_store
|
87
|
-
|
95
|
+
Cache.new
|
88
96
|
end
|
89
97
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: request_store_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Máximo Mussini
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -39,25 +39,19 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '5.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: concurrent-ruby
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0
|
48
|
-
- - ">="
|
49
|
-
- !ruby/object:Gem::Version
|
50
|
-
version: 0.3.5
|
47
|
+
version: '1.0'
|
51
48
|
type: :runtime
|
52
49
|
prerelease: false
|
53
50
|
version_requirements: !ruby/object:Gem::Requirement
|
54
51
|
requirements:
|
55
52
|
- - "~>"
|
56
53
|
- !ruby/object:Gem::Version
|
57
|
-
version: '0
|
58
|
-
- - ">="
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: 0.3.5
|
54
|
+
version: '1.0'
|
61
55
|
description: RequestLocals gives you per-request global storage in Rails
|
62
56
|
email:
|
63
57
|
- maximomussini@gmail.com
|
@@ -93,8 +87,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
87
|
version: '0'
|
94
88
|
requirements: []
|
95
89
|
rubyforge_project:
|
96
|
-
rubygems_version: 2.
|
90
|
+
rubygems_version: 2.5.1
|
97
91
|
signing_key:
|
98
92
|
specification_version: 4
|
99
93
|
summary: Per-request global storage for Rails
|
100
94
|
test_files: []
|
95
|
+
has_rdoc:
|