diff options
Diffstat (limited to 'vendor/codeberg.org/gruf/go-cache/v3/result/error.go')
-rw-r--r-- | vendor/codeberg.org/gruf/go-cache/v3/result/error.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/vendor/codeberg.org/gruf/go-cache/v3/result/error.go b/vendor/codeberg.org/gruf/go-cache/v3/result/error.go new file mode 100644 index 000000000..fa26083bf --- /dev/null +++ b/vendor/codeberg.org/gruf/go-cache/v3/result/error.go @@ -0,0 +1,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 + "\"" +} |