feat(cache): ajouter cache sémantique SimHash avec distance de Hamming#147
Merged
Destynova2 merged 2 commits intodevelopfrom Apr 11, 2026
Merged
feat(cache): ajouter cache sémantique SimHash avec distance de Hamming#147Destynova2 merged 2 commits intodevelopfrom
Destynova2 merged 2 commits intodevelopfrom
Conversation
f1b6867 to
b040ec7
Compare
3 tasks
Adds an in-memory SimHash-based semantic cache layer that detects near-duplicate prompts via 64-bit fingerprints and Hamming distance (default threshold ≤ 3 bits). The fuzzy layer is consulted before the exact SHA-256 cache to improve hit rates for rephrased requests. - src/cache/simhash.rs: normalize, compute, hamming_distance, SimHashCache - Integrated into ResponseCache via get_with_simhash / put_with_simhash - 16 new unit tests covering normalization, hashing, distance, and cache ops Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…tion - Supprimer le tri lexicographique des tokens qui detruisait le sens semantique (ex: "translate English to French" = "translate French to English"). L'ordre est desormais preserve. - Hasher chaque token avec sa position (hash_token_at) pour rendre le SimHash sensible a l'ordre des mots. - Remplacer RwLock<HashMap> par moka::sync::Cache avec max_capacity et TTL built-in, alignant le cycle de vie sur le cache exact. - Adapter response_cache.rs pour passer capacity/TTL au constructeur. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
b040ec7 to
5d8a630
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Test plan
🤖 Generated with Claude Code