On a recent project, I needed a quick, easy and simple caching function for XML files, so whipped up this little function.
How it works
It takes:
- The URL of the file / XML you need to cache
- The cache file, if one is not specified, it creates and uses “temp.txt”
- The amount of time to cache the file, if one is not specified, it uses 12 minutes (you can change this to whatever you would like
