MCPcopy Create free account
hub / github.com/convox/rack / ClearPrefix

Function ClearPrefix

pkg/cache/cache.go:93–109  ·  view source on GitHub ↗
(collection string, prefix string)

Source from the content-addressed store, hash-verified

91}
92
93func ClearPrefix(collection string, prefix string) error {
94 lock.Lock()
95 defer lock.Unlock()
96
97 for k := range cache[collection] {
98 match, err := hashPrefix(k, prefix)
99 if err != nil {
100 return err
101 }
102
103 if match {
104 delete(cache[collection], k)
105 }
106 }
107
108 return nil
109}
110
111func hashKey(key interface{}) (string, error) {
112 data, err := json.Marshal(key)

Callers 1

TestClearPrefixFunction · 0.85

Calls 1

hashPrefixFunction · 0.85

Tested by 1

TestClearPrefixFunction · 0.68