cthoyt / pystow

👜 Easily pick a place to store data for your Python code.
https://pystow.readthedocs.io
MIT License
36 stars 6 forks source link

Best practices for clearing stale files #54

Closed cmungall closed 2 years ago

cmungall commented 2 years ago

My workflow involves periodic

ls -alt ~/.data/oaklib

followed by looking at timestamps, using tacit knowledge about update frequencies of different ontologies, and selectively removing older files.

But if pystow is used in toolchains used by less technical users this could be confusing. What are the long term plans here? Should application developers write bespoke cache management solutions? This is not a bad idea as they can take advantage of specific conventions (e.g. I am caching sqlites of ontology files and I know versionIRI, when present, should uniquely identify the version). But it may be useful to have some kind of general purpose cache management helpers in the core, together with some kind of autoflush-after-N-days type options?

cthoyt commented 2 years ago

But if pystow is used in toolchains used by less technical users this could be confusing. What are the long term plans here?

None

Should application developers write bespoke cache management solutions? This is not a bad idea as they can take advantage of specific conventions (e.g. I am caching sqlites of ontology files and I know versionIRI, when present, should uniquely identify the version).

Yes. I did something like this in pyobo already, but it's application-specific and doesn't belong in pystow.

But it may be useful to have some kind of general purpose cache management helpers in the core, together with some kind of autoflush-after-N-days type options?

If you implement this yourself and think there's something worth moving upstream into PyStow, I would consider a PR

cmungall commented 2 years ago

Thanks, very usefull! I'll close for now as I don't have a concrete action.

I think a generic autoflush might be useful, lmk if you want a separate issue made for that. But I don't have immediate plans for that - for now I'm likely to focus on more application-specific methods (e.g. using versionIRI).