My project has a mysql database and a backend which is written by Clojure.
Some table of the database is updated only one time every day, to query the newest information we will use.
But:
the database is very large and network is slow, so every query will take seconds.
we need to do complex computations after each query.
we need to do many kinds of sql queries so it is not realistic to saving the results of every sql query.
we need to change the computation functions very frequently for the purpose of debugging.
All things are too slow for us now in the case of slow sql queries.
Fortunately, our data will only be updated one time every day, and that some of our queries from the database are very frequently used.
So we want to cache the frequently used sql queries and intermediate results.
Does Clojure's memoize
function useful for this kind of jobs? My afraid is that sql queries are not pure so memoize
should not cache their results. But during one day the results of our sql queries must be identical.
So can I memoize
the results during one day and automatically update the results the next day?
Thank you for your help!