FILE / ScuroNeko/mtg

antireplay/cache.go

Исходный файл и его история в репозитории.
FILE 6c7edfb7db1028c73cb5990866dafcfdef998824
Files
mtg/antireplay/cache.go
T
2019-10-07 17:51:21 +03:00

17 lines
295 B
Go

package antireplay
import "github.com/allegro/bigcache"
type cache struct {
cache *bigcache.BigCache
}
func (c *cache) Add(data []byte) {
c.cache.Set(string(data), nil) // nolint: errcheck
}
func (c *cache) Has(data []byte) bool {
_, err := c.cache.Get(string(data))
return err == nil
}