Volt.Cache (Volt v0.19.4)

Copy Markdown View Source

ETS-backed module cache keyed by path.

Caches compiled output so repeated requests for unchanged files skip the compilation step entirely.

Summary

Functions

Clear all cached entries.

Clear entries belonging to one development session.

Create the cache ETS table. Called once from Application.start/2.

Evict the entry for a cache key.

Evict all cache entries derived from a file path, including variant keys like path <> "?import".

Look up a cached entry. Returns nil on miss.

Look up any cached entry for a file path regardless of mtime.

Types

cache_entry()

@type cache_entry() :: %{mtime: integer(), entry: entry()}

entry()

@type entry() :: Volt.DevServer.CacheEntry.t()

Functions

clear()

@spec clear() :: :ok

Clear all cached entries.

clear_session(session)

Clear entries belonging to one development session.

create_table()

@spec create_table() :: :ok

Create the cache ETS table. Called once from Application.start/2.

evict(key, session \\ :default)

Evict the entry for a cache key.

evict_file(path, session \\ :default)

Evict all cache entries derived from a file path, including variant keys like path <> "?import".

get(path, mtime, session \\ :default)

Look up a cached entry. Returns nil on miss.

get_file(path, session \\ :default)

Look up any cached entry for a file path regardless of mtime.

put(path, mtime, entry, session \\ :default)

Store a compiled entry.