INNER CODE UNIT · Python
_calc_entry
python-cachier/cachier · src/cachier/core.py:127
def _calc_entry(core: _BaseCore, key, func, args, kwds, printer=lambda *_: None) -> Optional[Any]:
core.mark_entry_being_calculated(key)
try:
func_res = func(*args, **kwds)
stored = core.set_entry(key, func_res)
if not stored:
printer("Result exceeds entry_size_limit; not cached")
return func_res
finally:
core.mark_entry_not_calculated(key)
async def _calc_entry_async(core: _BaseCore, key, func, args, kwds, printer=lambda *_: None) -> Optional[Any]:
await core.amark_entry_being_calculated(key)
try:
func_res = await func(*args, **kwds)
stored = await core.aset_entry(key, func_res)
if not stored: