Get a cache entry by traversing the trie.
(self, model, tokens: Tuple[int, ...])
| 127 | return SearchResult(model, None, shorter, longer, common_prefix) |
| 128 | |
| 129 | def _get(self, model, tokens: Tuple[int, ...]) -> CacheEntry: |
| 130 | """Get a cache entry by traversing the trie.""" |
| 131 | current = self._cache[model] |
| 132 | for tok in tokens: |
| 133 | current = current[tok] |
| 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.""" |
no outgoing calls
no test coverage detected