-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rename EvictionCause to RemovalCause #33
Conversation
Another reason is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a minor nit to align the docstring of the class with the class rename.
src/cacheout/cache.py
Outdated
@@ -24,7 +24,7 @@ | |||
UNSET = object() | |||
|
|||
|
|||
class EvictionCause(Enum): | |||
class RemovalCause(Enum): | |||
""" | |||
An enum to represent the cause for the eviction of a cache entry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Can replace "eviction" with "removal".
An enum to represent the cause for the eviction of a cache entry. | |
An enum to represent the cause for the removal of a cache entry. |
Updated usage. Usageset cache = Cache(on_delete=on_delete)
Callable[[key: Hashable, value: Any, cause: RemovalCause], None] First parameter is the key of cache entry has been deleted. Second is the value. Third is the cause of cache entry removal.
class RemovalCause(Enum):
DELETE = auto()
SET = auto()
EXPIRED = auto()
FULL = auto()
POPITEM = auto()
TriggerThe table shows methods will trigger
⚠ |
In most caches(redis、caffeine and etc.), eviction means the entry is removed due to
maxsize
limit. Buton_delete
callback will be executed in all removal cases.EvictionCause
can lead to a misunderstanding,RemovalCause
should be a better name.