mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-26 17:38:39 +00:00
core/storage: Add delete() method to storage.cache.
This commit is contained in:
parent
5c1f197602
commit
8bcb3d8fb6
@ -73,6 +73,17 @@ def get(key: int) -> Any:
|
||||
return _caches[_active_session_id].get(key)
|
||||
|
||||
|
||||
def delete(key: int) -> None:
|
||||
if key & _SESSIONLESS_FLAG:
|
||||
if key in _sessionless_cache:
|
||||
del _sessionless_cache[key]
|
||||
return
|
||||
if _active_session_id is None:
|
||||
raise RuntimeError # no session active
|
||||
if key in _caches[_active_session_id]:
|
||||
del _caches[_active_session_id][key]
|
||||
|
||||
|
||||
def stored(key: int) -> Callable[[F], F]:
|
||||
def decorator(func: F) -> F:
|
||||
# if we didn't check this, it would be easy to store an Awaitable[something]
|
||||
|
Loading…
Reference in New Issue
Block a user