cache/exists.go

14 lines
239 B
Go
Raw Permalink Normal View History

2022-06-03 11:15:04 +03:00
package cache
import "github.com/dgraph-io/badger/v3"
func (c *CacheRepository) Exist(key string) (bool, error) {
_, err := c.Get(key)
if err != nil {
if err != badger.ErrKeyNotFound {
return false, nil
}
}
return true, err
}