MCPcopy Create free account
hub / github.com/abetlen/llama-cpp-python / __setitem__

Method __setitem__

llama_cpp/llama_cache.py:91–97  ·  view source on GitHub ↗
(self, key: Sequence[int], value: "llama_cpp.llama.LlamaState")

Source from the content-addressed store, hash-verified

89 return self._find_longest_prefix_key(tuple(key)) is not None
90
91 def __setitem__(self, key: Sequence[int], value: "llama_cpp.llama.LlamaState"):
92 key = tuple(key)
93 if key in self.cache_state:
94 del self.cache_state[key]
95 self.cache_state[key] = value
96 while self.cache_size > self.capacity_bytes and len(self.cache_state) > 0:
97 self.cache_state.popitem(last=False)
98
99
100# Alias for backwards compatibility

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected