summaryrefslogtreecommitdiff
path: root/vendor/codeberg.org/gruf/go-cache/v3/result/error.go
blob: fa26083bfc48d343ca2c99deb9f4fba8ca935487 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package result

import "errors"

// ErrUnkownLookup ...
var ErrUnknownLookup = errors.New("unknown lookup identifier")

// IsConflictErr returns whether error is due to key conflict.
func IsConflictErr(err error) bool {
	_, ok := err.(ConflictError)
	return ok
}

// ConflictError is returned on cache key conflict.
type ConflictError struct {
	Key string
}

// Error returns the message for this key conflict error.
func (c ConflictError) Error() string {
	return "cache conflict for key \"" + c.Key + "\""
}