Class: Sass::InMemoryCacheStore

Inherits:
CacheStore show all
Defined in:
lib/sass/cache_store.rb

Overview

A backend for the Sass cache using in-process memory.

Instance Method Summary collapse

Methods inherited from CacheStore

#key, #retrieve, #store

Constructor Details

#initializeInMemoryCacheStore

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)

See Also:



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