class Sprockets::CachedEnvironment
Experimental RBS support (using type sampling data from the type_fusion
project).
# sig/sprockets/cached_environment.rbs class Sprockets::CachedEnvironment < Sprockets::Base def stat: (String path) -> File::Stat? end
‘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 exception 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.fetch_or_store(path) { super(path) } end
def initialize(environment)
def initialize(environment) initialize_configuration(environment) @cache = environment.cache @stats = Concurrent::Map.new @entries = Concurrent::Map.new @uris = Concurrent::Map.new @processor_cache_keys = Concurrent::Map.new @resolved_dependencies = Concurrent::Map.new end
def load(uri)
def load(uri) @uris.fetch_or_store(uri) { super(uri) } end
def processor_cache_key(str)
def processor_cache_key(str) @processor_cache_keys.fetch_or_store(str) { super(str) } end
def resolve_dependency(str)
def resolve_dependency(str) @resolved_dependencies.fetch_or_store(str) { super(str) } end
def stat(path)
Experimental RBS support (using type sampling data from the type_fusion
project).
def stat: (String path) -> File::Stat?
This signature was generated using 4 samples from 1 application.
def stat(path) @stats.fetch_or_store(path) { super(path) } end