My app has a set of links, and generating these is a time-consuming operation. What would be the best way to implement a mechanism that refresh these data every day?
Barring that, I could make these links part of dcc.Store component with session-level persistence. How that store should be populated so that it’s executed only once per user session?
result = fun(get_ttl_hash(seconds=12 * 3600) # 24h cache
@functools.cache
def fun(ttl_hash=None):
pass
def get_ttl_hash(seconds: int = 24 * 3600) -> int:
"""
Return the same value withing `seconds` time period
:param seconds: time period
:return:
"""
return round(time.time() / seconds)