class Sprockets::CachedEnvironment
‘Environment#cached`.
`CachedEnvironment` should not be initialized directly. Instead use
is immutable.
behavior is ideal in production environments where the file system
for the instances lifetime. This makes `CachedEnvironment` much faster. This
The expection is that all of its file system methods are cached
`CachedEnvironment` is a special cached version of `Environment`.
def cached
def cached self end
def config=(config)
Cache is immutable, any methods that try to change the runtime config
def config=(config) raise RuntimeError, "can't modify immutable cached environment" end
def entries(path)
def entries(path) @entries[path] ||= super(path) end
def initialize(environment)
def initialize(environment) initialize_configuration(environment) @cache = environment.cache @stats = {} @entries = {} @uris = {} @processor_cache_keys = {} @resolved_dependencies = {} end
def load(uri)
def load(uri) @uris[uri] ||= super(uri) end
def processor_cache_key(str)
def processor_cache_key(str) @processor_cache_keys[str] ||= super(str) end
def resolve_dependency(str)
def resolve_dependency(str) @resolved_dependencies[str] ||= super(str) end
def stat(path)
def stat(path) @stats[path] ||= super(path) end