Macaw.Live.Proxy.Cache.Memory (macaw_live v0.1.0)

Copy Markdown View Source

The proxy's default cache (spec/06 §1.5): an ETS table its process owns, started under the host's Macaw.Live.Supervisor as <live>.ProxyCache, so the table is the supervisor's. It holds at most entries: answers (10,000) and bytes: bytes of bodies (256 MiB), dropping the least recently used past either; a body larger than bytes: is never held. Reads go to the table directly and tell the process what was used; writes go through the process. A stale entry is a miss, and dropped.

Summary

Functions

Its child spec: name: (required, the table's name too), entries: and bytes:.

Starts the cache: name:, an atom, required; entries: (10,000) and bytes: (268,435,456), positive integers. {:ok, pid}, or {:error, faults}: {[:name], :required}, {[key], {:type, :pos_integer}}.

Functions

child_spec(init_arg)

@spec child_spec(keyword()) :: Supervisor.child_spec()

Its child spec: name: (required, the table's name too), entries: and bytes:.

start_link(opts)

@spec start_link(keyword()) ::
  GenServer.on_start() | {:error, [Macaw.Base.Fault.t(), ...]}

Starts the cache: name:, an atom, required; entries: (10,000) and bytes: (268,435,456), positive integers. {:ok, pid}, or {:error, faults}: {[:name], :required}, {[key], {:type, :pos_integer}}.