FILE / ScuroNeko/mtg

antireplay/cache.go

Исходный файл и его история в репозитории.
FILE 432e2970a06056c36a83e94a0da8bd3ea8138815
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
}