Skip to content
This repository was archived by the owner on Apr 18, 2021. It is now read-only.

Commit 21c1c17

Browse files
committed
Use fnv64a instead of sha256 for cache keys
1 parent 10f3e44 commit 21c1c17

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

cache.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package httpcache
33
import (
44
"bufio"
55
"bytes"
6-
"crypto/sha256"
76
"errors"
87
"fmt"
98
"io"
@@ -17,6 +16,7 @@ import (
1716
"time"
1817

1918
vfs "gopkgs.com/vfs.v1"
19+
"hash/fnv"
2020
)
2121

2222
const (
@@ -190,8 +190,8 @@ func (c *Cache) Freshen(res *Resource, keys ...string) error {
190190
}
191191

192192
func hashKey(key string) string {
193-
h := sha256.New()
194-
io.WriteString(h, key)
193+
h := fnv.New64a()
194+
h.Write([]byte(key))
195195
return fmt.Sprintf("%x", h.Sum(nil))
196196
}
197197

0 commit comments

Comments
 (0)