Class: EntityCache::Storage::Temporary
- Inherits:
-
Object
- Object
- EntityCache::Storage::Temporary
show all
- Includes:
- Log::Dependency
- Defined in:
- lib/entity_cache/storage/temporary.rb,
lib/entity_cache/storage/temporary/scope.rb,
lib/entity_cache/storage/temporary/factory.rb,
lib/entity_cache/storage/temporary/scope/shared.rb,
lib/entity_cache/storage/temporary/scope/exclusive.rb
Defined Under Namespace
Modules: Assertions, Factory, Scope, Substitute
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(subject) ⇒ Temporary
Returns a new instance of Temporary.
8
9
10
|
# File 'lib/entity_cache/storage/temporary.rb', line 8
def initialize(subject)
@subject = subject
end
|
Instance Attribute Details
#subject ⇒ Object
Returns the value of attribute subject.
6
7
8
|
# File 'lib/entity_cache/storage/temporary.rb', line 6
def subject
@subject
end
|
Class Method Details
.build(subject) ⇒ Object
12
13
14
15
|
# File 'lib/entity_cache/storage/temporary.rb', line 12
def self.build(subject)
instance = new subject
instance
end
|
17
18
19
20
21
22
23
|
# File 'lib/entity_cache/storage/temporary.rb', line 17
def self.configure(receiver, subject, scope: nil, attr_name: nil)
attr_name ||= :temporary_store
instance = Factory.(subject, scope: scope)
receiver.public_send "#{attr_name}=", instance
instance
end
|
Instance Method Details
#get(id) ⇒ Object
25
26
27
|
# File 'lib/entity_cache/storage/temporary.rb', line 25
def get(id)
records[id]
end
|
#put(record) ⇒ Object
29
30
31
|
# File 'lib/entity_cache/storage/temporary.rb', line 29
def put(record)
records[record.id] = record
end
|