Hacker News new | ask | show | jobs
by zbowling 738 days ago
This would break a bunch of little things in annoying ways. Like I have shell script tools that store shell scrollback logs in .cache, and I want that past reboot.
1 comments

FWIW, I've been doing it for many years, and not noticed any problems.

If something is supposed to persist past reboot, I wouldn't put it in `.cache`. Though I don't know offhand what the official documented behavior of `.cache` is, and I can't immediately find that documentation (maybe some open desktop cabal thing?).

XDG_CACHE_HOME same text across bott resources https://specifications.freedesktop.org/basedir-spec/basedir-... or https://wiki.archlinux.org/title/XDG_Base_Directory

> $XDG_CACHE_HOME defines the base directory relative to which user-specific non-essential data files should be stored. If $XDG_CACHE_HOME is either not set or empty, a default equal to $HOME/.cache should be used.

It's fine to put ~/.cache on tmpfs, but doing it by default for the general case is going to cause a lot of hurt.

My ~/.cache could be rm -rf'd without too much worry right now, but that doesn't mean that persisting it isn't useful. For example on my system right now:

- Browser cache is useful to persist, especially with some larger sites.

- I put my Go module and build cache in ~/.cache, and while that can be deleted it's useful to persist because it make builds shorter, and avoids having to (re)-download the same modules over and over again. Note that at the moment my internet is kind of crappy so this can take quite a while.

- Some other download cache things in there, from luarocks, xlocate, few other things.

- I store psql history per-database in ~/.cache/psql-dbname. It's useful to keep this around.

- Vim backup files, persistent undo files, and swap files are stored in ~/.vim. The swap files especially are important because I want to keep them after an unexpected system crash.

Some of this is solvable by moving stuff to other directories. Others are inherently unsolvable.

I also have just 8G of RAM, which is fine but not fine for storing ~/.cache in RAM.

That's silly. Cache is there for preserving things across many runs of some application. Applications certainly use it in a way that assumes long term storage. It's not for short term temporary things. It's a cache.

It's not going to cause "problems". It's just going to massively slow down many use cases that rely on downloads.