-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cache: Return ErrNotFound error from Get()
Previously, when an item is not found in the cache, no error was returned and instead the returned value was expected to be checked for nil to determine if the object was found or not. Considering that other cache functions like GetExpiration() and SetExpiration() return ErrNotFound for items not in cache, it's more consistent to return ErrNotFound for Get() as well. Returning ErrNotFound from Get() makes it clear that the object was not found, instead of needing to check the obtained value. There is no more need to return a pointer to the item. Return the item value instead. This changes the Store interface method signature for Get(). Signed-off-by: Sunny <github@darkowlzz.space>
- Loading branch information
Showing
6 changed files
with
38 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters