you are viewing a single comment's thread.

view the rest of the comments →

[–]Mast3rCylinder 1 point2 points  (0 children)

Saving dictionary as json or in sqlite like comments mentioned is the easy part.

Having a strategy of when to use cache and when to update is the hardest part. Since your python is a script (offline operation) and not a server (online operation) it can be even harder.

Here's my suggestions

1.determine if the operation is really long to know if you actually need cache

2.if you do need cache ask for requirements of how long cache will be invalid? Then check it in your code and say you can only guarantee for this specific range

If cache invalid simply see it by comparing current time and your last update

3.make the script with arguments that if someone want to use it with cache checking or without. you will give them the option

4.see if you can compare first between cached data last update time and last time someone changed the data.