Expand description
In-memory cache for market and execution data, with optional persistent backing.
Provides methods to load, query, and update cached data such as instruments, orders, and prices.
§Persistence policy
Cache operations complete valid in-memory changes independently of optional persistence. All cache
writes, including indexes, snapshots, component state, heartbeats, and purge deletions, log
persistence failures at ERROR without propagating them or interrupting event and command
processing. Validation and in-memory errors still propagate, including DeFi currency integrity
errors reported by a backing database. The cache also propagates read, restoration, and explicit
database flush errors returned by its backing.
A successful cache call confirms the cache operation, not queue admission or durable storage. For queued backings, database writes can fail after the cache call returns. Both enqueue and downstream write failures are logged as persistence failures.
The node or backtest shutdown_on_error setting requests a normal shutdown on Rust error logs
emitted after the runtime starts, including persistence failures. It does not abort the process
or roll back the current operation. Error-triggered shutdown handling is disabled before final
component-state saves, which still follow this best-effort policy.
Re-exports§
pub use config::CacheConfig;pub use refs::AccountRef;pub use refs::AccountRefMut;pub use refs::OrderRef;pub use refs::OrderRefMut;pub use refs::PositionRef;pub use refs::PositionRefMut;
Modules§
- config
- database
- Provides a
Cachedatabase backing. - fifo
- Bounded FIFO caches for tracking IDs and key-value pairs with O(1) lookups.
- quote
- Generic quote cache for maintaining the last known quote per instrument.
- refs
- Lifetime-scoped reference newtypes for values held in the platform cache.
Structs§
- Cache
- A common in-memory
Cachefor market and execution related data. - Cache
Api - User-facing cache API.
- Cache
Snapshot Ref - Cache-owned reference to a snapshot blob.
- Cache
View - Read-only view over the platform cache.
- Venue
Order IdOwnership Error - Error returned when a venue order ID is already owned by another client order.
Enums§
- Account
Lookup Error - Error returned when an account cannot be resolved from a cache or store.
- Currency
Lookup Error - Error returned when a currency cannot be resolved from a cache or store.
- Instrument
Lookup Error - Error returned when an instrument cannot be resolved from a cache or store.
- Order
Book Lookup Error - Error returned when an order book cannot be resolved from a cache or store.
- Order
List Lookup Error - Error returned when an order list cannot be resolved from a cache or store.
- Order
Lookup Error - Error returned when an order cannot be resolved from a cache or store.
- OwnOrder
Book Lookup Error - Error returned when an own order book cannot be resolved from a cache or store.
- Position
Lookup Error - Error returned when a position cannot be resolved from a cache or store.
- Synthetic
Instrument Lookup Error - Error returned when a synthetic instrument cannot be resolved from a cache or store.
Constants§
- ACCOUNT_
NOT_ FOUND - Message used for a missing account lookup.
- CURRENCY_
NOT_ FOUND - Message used for a missing currency lookup.
- INSTRUMENT_
NOT_ FOUND - Message used for a missing instrument lookup.
- ORDER_
BOOK_ NOT_ FOUND - Message used for a missing order book lookup.
- ORDER_
LIST_ NOT_ FOUND - Message used for a missing order list lookup.
- ORDER_
NOT_ FOUND - Message used for a missing order lookup.
- OWN_
ORDER_ BOOK_ NOT_ FOUND - Message used for a missing own order book lookup.
- POSITION_
NOT_ FOUND - Message used for a missing position lookup.
- SYNTHETIC_
INSTRUMENT_ NOT_ FOUND - Message used for a missing synthetic instrument lookup.