cachier
cachier copied to clipboard
Allow to globally specify the location of the cache dir
In addition to configuring the cache file path for each wrapped function, a way to globally change the location of the general cache directory for all cachier caches is required.
A possible API:
>>> import cachier
>>> cachier.get_global_cache_dpath()
'/home/myuser/.cachier'
>>> cachier.set_global_cache_dpath('/home/opt/caches/')
>>> cachier.get_global_cache_dpath()
'/home/opt/caches/'
I wouldn't make this a priority. The current API is not that cumbersome. If this does happen, I might suggest using default instead of global (as I assume it could be overridden still). And use dir instead of dpath. So it would be get_default_cache_dir().
Alternatively, do you need the complex logic of a function or can you get away with cachier.defaut_cache_dir = "/foo"?