MCPcopy
hub / github.com/mudler/LocalAI / _delete

Method _delete

backend/python/mlx/mlx_cache.py:136–148  ·  view source on GitHub ↗

Delete a cache entry and clean up empty trie nodes.

(self, model, tokens: Tuple[int, ...])

Source from the content-addressed store, hash-verified

134 return current["cache"]
135
136 def _delete(self, model, tokens: Tuple[int, ...]) -> None:
137 """Delete a cache entry and clean up empty trie nodes."""
138 path = [self._cache[model]]
139 for tok in tokens:
140 path.append(path[-1][tok])
141 del path[-1]["cache"]
142
143 # Clean up empty nodes bottom-up
144 for i in reversed(range(len(tokens))):
145 d_prev, d, t = path[i], path[i + 1], tokens[i]
146 if len(d) > 0:
147 break
148 del d_prev[t]
149
150 def _extract(self, model, tokens: Tuple[int, ...]) -> CacheEntry:
151 """

Callers 2

_extractMethod · 0.95
insert_cacheMethod · 0.95

Calls 1

appendMethod · 0.80

Tested by

no test coverage detected