Sha256: 3d4a12c9c2d9007cba6cd635ee4addb2e06e8579a8e2ce7c3c63c7d42d67c566
Contents?: true
Size: 673 Bytes
Versions: 2
Compression:
Stored size: 673 Bytes
Contents
require 'ollama/documents/cache/common' class Ollama::Documents::MemoryCache include Ollama::Documents::Cache::Common def initialize(prefix:) super(prefix:) @data = {} end def [](key) @data[pre(key)] end def []=(key, value) @data[pre(key)] = value end def key?(key) @data.key?(pre(key)) end def delete(key) @data.delete(pre(key)) end def size count end def clear @data.delete_if { |key, _| key.start_with?(@prefix) } self end def each(&block) @data.select { |key,| key.start_with?(@prefix) }.each(&block) end include Enumerable def full_each(&block) @data.each(&block) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ollama-ruby-0.12.1 | lib/ollama/documents/cache/memory_cache.rb |
ollama-ruby-0.12.0 | lib/ollama/documents/cache/memory_cache.rb |