evt-entity_cache 0.12.0.0 → 0.13.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: 9c13e158e958cbdf1b17b702403a04cab1e97b9e
4
- data.tar.gz: c87287bf2c2dd8c6b4c8497f422e3d0de3dc04de
3
+ metadata.gz: c760e8d0f0ab3b57d038d2611c3e79d5e5f226cb
4
+ data.tar.gz: 744488e69439058ff3f775a98f17b93c1551a06e
5
5
  SHA512:
6
- metadata.gz: 376f814a1a462177be63978ad21dcb44a4c411982ec80a9f7272b2b7f19e38489a62930705840ffbfbe92445ed047943aa7984ae1adc12f4e83b0402dc194af3
7
- data.tar.gz: b5e0b438bd336036fb33b4edf8a51781b92789bb84f7d9ebc11f69164247fe84cbd558ec99e053323e5c8cc2eee934b4eb7e153948627bfd4df21565c78e1cdd
6
+ metadata.gz: '07090ee107dc4cbe58dffcf6e9d96e492e40507b0dc4db5fe7dc85f4cbbdecfdb31a2b25f473eb8d217f0383351fac3600d827c0a4f8cdabeba26e5fc661ef04'
7
+ data.tar.gz: 1bbcfc1b53dfa8411446b5df243418eda16014b91c3977f37fa8e037354012dd88cd99384bfac9d7232af4dd35f282c5cdd38f25443e7d3a28028026a651be2c
@@ -3,7 +3,7 @@ class EntityCache
3
3
  class Temporary
4
4
  module Build
5
5
  def self.call(subject, scope: nil)
6
- scope ||= Scope::Defaults::Name.get
6
+ scope ||= Scope::Defaults.name
7
7
 
8
8
  scope_class = self.scope_class scope
9
9
 
@@ -2,9 +2,11 @@ class EntityCache
2
2
  module Storage
3
3
  class Temporary
4
4
  module Scope
5
- Error = Class.new StandardError
6
-
7
5
  module Defaults
6
+ def self.name
7
+ Name.get
8
+ end
9
+
8
10
  module Name
9
11
  def self.get
10
12
  value = env_var_value || self.value
@@ -0,0 +1,9 @@
1
+ class EntityCache
2
+ module Storage
3
+ class Temporary
4
+ module Scope
5
+ Error = Class.new(StandardError)
6
+ end
7
+ end
8
+ end
9
+ end
@@ -4,11 +4,25 @@ class EntityCache
4
4
  module Scope
5
5
  class Shared < Temporary
6
6
  def records
7
- records_registry[subject] ||= {}
7
+ subject_registry[subject] ||= {}
8
8
  end
9
9
 
10
- def records_registry
11
- @@records_registry ||= {}
10
+ def subject_registry
11
+ current_thread = Thread.current
12
+
13
+ if current_thread.thread_variable?(thread_local_variable)
14
+ subject_registry = current_thread.thread_variable_get(thread_local_variable)
15
+ else
16
+ subject_registry = {}
17
+
18
+ current_thread.thread_variable_set(thread_local_variable, subject_registry)
19
+ end
20
+
21
+ subject_registry
22
+ end
23
+
24
+ def thread_local_variable
25
+ :entity_cache_subject_registry
12
26
  end
13
27
  end
14
28
  end
data/lib/entity_cache.rb CHANGED
@@ -17,7 +17,8 @@ require 'entity_cache/storage/persistent/telemetry'
17
17
 
18
18
  require 'entity_cache/storage/temporary'
19
19
  require 'entity_cache/storage/temporary/build'
20
- require 'entity_cache/storage/temporary/scope'
20
+ require 'entity_cache/storage/temporary/scope/defaults'
21
+ require 'entity_cache/storage/temporary/scope/error'
21
22
  require 'entity_cache/storage/temporary/scope/exclusive'
22
23
  require 'entity_cache/storage/temporary/scope/shared'
23
24
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evt-entity_cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0.0
4
+ version: 0.13.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Eventide Project
@@ -150,7 +150,8 @@ files:
150
150
  - lib/entity_cache/storage/persistent/telemetry.rb
151
151
  - lib/entity_cache/storage/temporary.rb
152
152
  - lib/entity_cache/storage/temporary/build.rb
153
- - lib/entity_cache/storage/temporary/scope.rb
153
+ - lib/entity_cache/storage/temporary/scope/defaults.rb
154
+ - lib/entity_cache/storage/temporary/scope/error.rb
154
155
  - lib/entity_cache/storage/temporary/scope/exclusive.rb
155
156
  - lib/entity_cache/storage/temporary/scope/shared.rb
156
157
  - lib/entity_cache/substitute.rb