Class: Nexo::Session::MemoryStore
- Inherits:
-
Object
- Object
- Nexo::Session::MemoryStore
- Defined in:
- lib/nexo/session.rb
Overview
Process-wide, in-memory backend for the plain-Ruby path. Holds one
{agent:, chat:} entry per [agent_name, instance_id] pair so a later
Session.resume in the same process resumes the very same thread AND reuses
the agent that owns its live tools/connections. Not durable — a fresh
process starts empty. Mirrors RunStore::Memory's class-level singleton so
independent callers share one store.
Class Method Summary collapse
-
.fetch(agent_name, instance_id) ⇒ Object
Returns the stored
{agent:, chat:}entry for the pair, building it once (via the block) on first resume and reusing it thereafter. -
.reset! ⇒ Object
Clears the shared table.
Class Method Details
.fetch(agent_name, instance_id) ⇒ Object
Returns the stored {agent:, chat:} entry for the pair, building it once
(via the block) on first resume and reusing it thereafter.
141 142 143 |
# File 'lib/nexo/session.rb', line 141 def fetch(agent_name, instance_id) @threads[[agent_name, instance_id]] ||= yield end |
.reset! ⇒ Object
Clears the shared table. Intended for test isolation.
146 147 148 |
# File 'lib/nexo/session.rb', line 146 def reset! @threads = {} end |