Class: Sass::InMemoryCacheStore
- Inherits:
-
CacheStore
- Object
- CacheStore
- Sass::InMemoryCacheStore
- Defined in:
- lib/sass/cache_store.rb
Overview
A backend for the Sass cache using in-process memory.
Instance Method Summary collapse
- #_retrieve(key, version, sha)
- #_store(key, version, sha, contents)
-
#initialize ⇒ InMemoryCacheStore
constructor
Create a new, empty cache store.
-
#reset!
Destructively clear the cache.
Methods inherited from CacheStore
Constructor Details
#initialize ⇒ InMemoryCacheStore
Create a new, empty cache store.
164 165 166 |
# File 'lib/sass/cache_store.rb', line 164
def initialize
@contents = {}
end
|
Instance Method Details
#_retrieve(key, version, sha)
169 170 171 172 173 174 175 |
# File 'lib/sass/cache_store.rb', line 169
def _retrieve(key, version, sha)
if @contents.has_key?(key)
return unless @contents[key][:version] == version
return unless @contents[key][:sha] == sha
return @contents[key][:contents]
end
end
|
#_store(key, version, sha, contents)
178 179 180 181 182 183 184 |
# File 'lib/sass/cache_store.rb', line 178
def _store(key, version, sha, contents)
@contents[key] = {
:version => version,
:sha => sha,
:contents => contents
}
end
|
#reset!
Destructively clear the cache.
187 188 189 |
# File 'lib/sass/cache_store.rb', line 187
def reset!
@contents = {}
end
|