Class: TypeBalancer::TypeExtractorRegistry
- Inherits:
-
Object
- Object
- TypeBalancer::TypeExtractorRegistry
- Defined in:
- lib/type_balancer/type_extractor_registry.rb
Overview
Registry to memoize TypeExtractor per type_field in thread/request scope
Constant Summary collapse
- STORAGE_KEY =
:type_balancer_extractors
Class Method Summary collapse
Class Method Details
.cache ⇒ Object
16 17 18 |
# File 'lib/type_balancer/type_extractor_registry.rb', line 16 def self.cache Thread.current[STORAGE_KEY] ||= {} end |
.clear! ⇒ Object
12 13 14 |
# File 'lib/type_balancer/type_extractor_registry.rb', line 12 def self.clear! Thread.current[STORAGE_KEY] = nil end |
.get(type_field) ⇒ Object
8 9 10 |
# File 'lib/type_balancer/type_extractor_registry.rb', line 8 def self.get(type_field) cache[type_field] ||= TypeExtractor.new(type_field) end |