cachew icon indicating copy to clipboard operation
cachew copied to clipboard

support pathlib.Path

Open karlicoss opened this issue 5 years ago • 2 comments

Path is a trivial wrapper around str. I guess generally think of a good way to allow adhoc mapping of simple types. Perhaps current Exception makes sense.

karlicoss avatar Jan 08 '20 22:01 karlicoss

Wouldn't be interesting to hash & compare the actual file it refers to see if it has changed, to invalidate the cache? That way, promensia indexcould benefit if nothing has changed on disk.

ankostis avatar Feb 11 '21 23:02 ankostis

Yep, this is the idea! Even the stat().st_mtime is probably a good proxy for the file modification time?

It's possible to support something like it, for example: https://github.com/karlicoss/HPI/blob/ed47e98d5c85b3334b3be059ad31b82c6fc0d19c/my/emfit/init.py#L27-L33

Another example (which Promnesia already benefits from) is caching org-mode files -- it makes incremental indexing pretty instantaneous on my computer, at least

https://github.com/karlicoss/HPI/blob/e81dddddf083ffd81aa7e2b715bd34f59949479c/my/orgmode.py#L78-L81

but would be nice to make it 'native'!

karlicoss avatar Feb 12 '21 18:02 karlicoss