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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b17ce75ce44d00e22a3c88e3d2200714b3ede747
4
- data.tar.gz: f0b63afb4d88307e211734be8f07312ee39112ae
3
+ metadata.gz: 2738ba0a9382c489a0c1f2cf8b3b398d2d4512b2
4
+ data.tar.gz: 2a04e6524fad9edf05669e4cede924afe6751d3e
5
5
  SHA512:
6
- metadata.gz: c1dfc33174e4ef819694d9d92f0c657832a0a273cb4d61486f20d22f825b69c9fcc371320bdceafd0fb8f151a84d2a06731fd12964a759fe0a9c7f849201caae
7
- data.tar.gz: c3fa2ee4a89e114d0ccfa10807070b6e4a79facfe6a01c24f38c7ba124462559ae7dc60f50c41bb28b15bace7921cd1f8d38c391ee4ee611a0807f29643ef064
6
+ metadata.gz: 8f6b72e78bcbe9c507dd0c1cba9ad6f481d694cb53662bf03771f69ca5d43ce47119f9e7bbd97181a89e73aceb93859dddf4478be2ef5cb0f6d889fac5478478
7
+ data.tar.gz: af5a9b6a7f85bb62fe17ea12d20037f035ba30ebac02a04ea27adbe72c7385f5e1e78b7d68d8c2ea63df7af014d99c8465b01010f434301a47c2810c89f02798
@@ -1,6 +1,6 @@
1
1
  require 'singleton'
2
2
  require 'forwardable'
3
- require 'thread_safe'
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 = ThreadSafe::Cache.new
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 = ThreadSafe::Cache.new
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
- ThreadSafe::Cache.new
95
+ Cache.new
88
96
  end
89
97
  end
@@ -1,4 +1,4 @@
1
1
  module RequestStoreRails
2
2
 
3
- VERSION = '0.0.3'
3
+ VERSION = '1.0.0'
4
4
  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.3
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: 2015-04-13 00:00:00.000000000 Z
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: thread_safe
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.3'
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.3'
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.4.3
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: