mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-31 14:44:20 +01:00
fix(tui): faster cache algo
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
package chat
|
package chat
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/sha256"
|
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"hash/fnv"
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ func NewMessageCache() *MessageCache {
|
|||||||
|
|
||||||
// generateKey creates a unique key for a message based on its content and rendering parameters
|
// generateKey creates a unique key for a message based on its content and rendering parameters
|
||||||
func (c *MessageCache) GenerateKey(params ...any) string {
|
func (c *MessageCache) GenerateKey(params ...any) string {
|
||||||
h := sha256.New()
|
h := fnv.New64a()
|
||||||
for _, param := range params {
|
for _, param := range params {
|
||||||
h.Write(fmt.Appendf(nil, ":%v", param))
|
h.Write(fmt.Appendf(nil, ":%v", param))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user