Module: OllamaChat::DocumentCache
- Included in:
- Chat
- Defined in:
- lib/ollama_chat/document_cache.rb
Instance Method Summary collapse
-
#configure_cache ⇒ Class
The configure_cache method determines the appropriate cache class to use for document storage.
-
#document_cache_class ⇒ Class
The document_cache_class method returns the cache class specified in the configuration.
Instance Method Details
#configure_cache ⇒ Class
The configure_cache method determines the appropriate cache class to use for document storage. It checks if the -M option was specified to use MemoryCache, otherwise it attempts to use the configured cache class. If an error occurs during this process, it falls back to using MemoryCache and reports the error.
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/ollama_chat/document_cache.rb', line 18 def configure_cache if @opts[?M] Documentrix::Documents::MemoryCache else document_cache_class end rescue => e STDERR.puts "Caught #{e.class}: #{e} => Falling back to MemoryCache." Documentrix::Documents::MemoryCache end |
#document_cache_class ⇒ Class
The document_cache_class method returns the cache class specified in the configuration.
6 7 8 |
# File 'lib/ollama_chat/document_cache.rb', line 6 def document_cache_class Object.const_get(config.cache) end |