Hi,
I am using python’s functools lru_cache(https://docs.python.org/3/library/functools.html#functools.lru_cache )decorator with maxsize = 1 to cache a database query in one function that will be called from a custom action.
At midnight everyday I want to call this function. so that database query is executed and stored in cache for day use.
my lru_cache function is:\
You could use an external event although I’m not sure if this will work since the event would not be assocated with a session. I suspect it will still work but you could also save a session id from one of your own conversations.
actually what i am doing there is storing database query result in lru_cache. and I want to sync(call) the database query in the midnight everyday. So, the changes in the database will reflect in cache also. without the need of user conversing with the chatbot and it is not related to User conversations. It should be automatically done in the backend like some other database sync up in python.
Is there any way to do this in rasa. or is there any way to cache some database query result in rasa without lru_cache and do sync operations every midnight.