File tree Expand file tree Collapse file tree 1 file changed +2
-11
lines changed Expand file tree Collapse file tree 1 file changed +2
-11
lines changed Original file line number Diff line number Diff line change 11package cache
22
33import (
4- "crypto/sha256"
54 "llm-language-server/lsp"
65 "time"
76)
@@ -24,28 +23,20 @@ func checkExpiredKeys() {
2423 }
2524}
2625
27- func getKey (prompt string , suffix string ) string {
28- cacheKeyHash := sha256 .New ()
29- cacheKeyHash .Write ([]byte (prompt + "_" + suffix ))
30- return string (cacheKeyHash .Sum (nil ))
31- }
32-
3326func Set (prompt string , suffix string , value []lsp.CompletionItem ) {
3427 if ! started {
3528 return
3629 }
3730
38- key := getKey (prompt , suffix )
39- cacheMap [key ] = CacheValue {Data : value , Ex : time .Now ().Add (ex )}
31+ cacheMap [prompt + suffix ] = CacheValue {Data : value , Ex : time .Now ().Add (ex )}
4032}
4133
4234func Get (prompt string , suffix string ) ([]lsp.CompletionItem , bool ) {
4335 if ! started {
4436 return nil , false
4537 }
4638
47- key := getKey (prompt , suffix )
48- value , exists := cacheMap [key ]
39+ value , exists := cacheMap [prompt + suffix ]
4940
5041 if exists {
5142 return value .Data , true
You can’t perform that action at this time.
0 commit comments