Module: Llmemory::ShortTerm::Stores

Defined in:
lib/llmemory/short_term/stores.rb,
lib/llmemory/short_term/stores/base.rb,
lib/llmemory/short_term/stores/redis_store.rb,
lib/llmemory/short_term/stores/memory_store.rb,
lib/llmemory/short_term/stores/postgres_store.rb,
lib/llmemory/short_term/stores/active_record_store.rb,
lib/llmemory/short_term/stores/active_record_checkpoint.rb

Defined Under Namespace

Classes: ActiveRecordCheckpoint, ActiveRecordStore, Base, MemoryStore, PostgresStore, RedisStore

Class Method Summary collapse

Class Method Details

.build(store_type = nil) ⇒ Object

Single source of truth for selecting a short-term store backend. Shared by Checkpoint, SessionLifecycle and WorkingMemory.



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/llmemory/short_term/stores.rb', line 13

def self.build(store_type = nil)
  case (store_type || Llmemory.configuration.short_term_store).to_sym
  when :memory then MemoryStore.new
  when :redis then RedisStore.new
  when :postgres then PostgresStore.new
  when :active_record, :activerecord
    require_relative "stores/active_record_store"
    ActiveRecordStore.new
  else
    MemoryStore.new
  end
end