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

No-op return self as cached environment.
def cached
  self
end

def config=(config)

should bomb.
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)

Internal: Cache Environment#entries
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)

Internal: Cache Environment#load
def load(uri)
  @uris.fetch_or_store(uri) { super(uri) }
end

def processor_cache_key(str)

Internal: Cache Environment#processor_cache_key
def processor_cache_key(str)
  @processor_cache_keys.fetch_or_store(str) { super(str) }
end

def resolve_dependency(str)

Internal: Cache Environment#resolve_dependency
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.

Internal: Cache Environment#stat
def stat(path)
  @stats.fetch_or_store(path) { super(path) }
end