Skip to main content

Module cache

Module cache 

Source
Expand description

Redis-backed cache database for the system.

§Architecture

Uses two Redis connections with distinct roles:

  • READ (self.con): synchronous queries (keys, read, load_all), owned by the main struct.
  • WRITE: owned by a background task on get_runtime(), receives commands via an unbounded tokio::sync::mpsc channel.

All write operations (insert, update, delete, flush) are routed through the command channel so they execute on the WRITE connection. This avoids cross-runtime I/O issues since the WRITE connection is always created on the Nautilus runtime.

Synchronous callers (close, flushdb_sync) use std::sync::mpsc reply channels to block until the background task confirms completion. When called from the Nautilus runtime itself, block_in_place is used automatically to avoid stalling the worker thread.

Structs§

DatabaseCommand
Represents a database command to be performed which may be executed in a task.
RedisCacheDatabase
RedisCacheDatabaseAdapter

Enums§

DatabaseOperation
A type of database operation.