Class: Sass::CacheStores::Memory
- Inherits:
- Base
- Object
- Base
- Sass::CacheStores::Memory
- Defined in:
- /Users/ceppstei/Projects/sass-lang/.sass/lib/sass/cache_stores/memory.rb
Overview
A backend for the Sass cache using in-process memory.
Instance Method Summary (collapse)
- - (Memory) initialize constructor
Create a new, empty cache store.
- - reset!
Destructively clear the cache.
- - retrieve(key, sha)
- - store(key, sha, obj)
Methods inherited from Base
Constructor Details
- (Memory) initialize
Create a new, empty cache store.
23 24 25 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/cache_stores/memory.rb', line 23
def initialize
@contents = {}
end |
Instance Method Details
- reset!
Destructively clear the cache.
41 42 43 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/cache_stores/memory.rb', line 41
def reset!
@contents = {}
end |
- retrieve(key, sha)
28 29 30 31 32 33 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/cache_stores/memory.rb', line 28
def retrieve(key, sha)
return unless @contents.has_key?(key)
return unless @contents[key][:sha] == sha
obj = @contents[key][:obj]
obj.respond_to?(:deep_copy) ? obj.deep_copy : obj.dup
end |
- store(key, sha, obj)
36 37 38 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/cache_stores/memory.rb', line 36
def store(key, sha, obj)
@contents[key] = {:sha => sha, :obj => obj}
end |