Longbridge.Symbol.Cache (longbridge v0.1.0)

Copy Markdown View Source

Runtime-resolved counter_id cache.

Persisted to $LONGBRIDGE_CACHE_DIR/counter-ids.csv (default ~/.longbridge/cache/counter-ids.csv). One counter_id per line, in the format SYMBOL,COUNTER_ID, mirroring the format of the embedded directory files in priv/counter_ids/. The table is owned by Longbridge.Symbol.Store so it survives short-lived callers.

Summary

Functions

Look up a user symbol against the on-disk cache. Returns the counter_id on hit, nil otherwise.

Add new counter_ids to the in-memory cache and persist them to disk. Duplicates are ignored.

Functions

lookup(symbol)

@spec lookup(String.t()) :: String.t() | nil

Look up a user symbol against the on-disk cache. Returns the counter_id on hit, nil otherwise.

put(counter_ids)

@spec put([String.t()]) :: :ok

Add new counter_ids to the in-memory cache and persist them to disk. Duplicates are ignored.

reset()

@spec reset() :: :ok