dimo414 / bash-cache

Transparent caching layer for bash functions; particularly useful for functions invoked as part of your prompt.
GNU General Public License v3.0
74 stars 4 forks source link

Multi-tiered cache #1

Closed dimo414 closed 3 years ago

dimo414 commented 6 years ago

Original report by Michael Diamond (Bitbucket: dimo414).


As suggested in https://codereview.stackexchange.com/q/170958/14237, having a tiered cache would make common cases much faster than the several reads from disk that are currently required.

One potentially easy option would be to use /dev/smh before /tmp (but falling back to /tmp if /dev/smh is busted). Need to account for (and document?) /dev/smh behavior better, since previously I'd seen files randomly disappearing from under me.

dimo414 commented 6 years ago

Original comment by Michael Diamond (Bitbucket: dimo414).


Given the existence of BC_CACHE_DIR, and the potential for systems to configure their TMPDIR or /tmp directory to use tmpfs, this is probably not as important as I initially thought.

We could experiment with heuristically using /dev/shm if it's a tmpfs (it's not on WSL) and the default cache directory is not, but it's not so bad for users to do this themselves.