Open crazy4chrissi opened 6 years ago
This is also really useful:
vmtouch -vf . | grep '\[.*O.*\]' --before-context=1 | grep '^\.'
It prints the list of currently (partly) cached files in the current folder. You can write this into a file cached
:
vmtouch -vf . | grep '\[.*O.*\]' --before-context=1 | grep '^\.' > cached
and enforce that these files remain cached:
vmtouch -d -l -b cached
Thanks for the feature suggestion and the command-line workaround. I'm not opposed to adding a switch or option to implement this functionality either.
Ideally there would be a more machine-friendly output for vmtouch that is easier to post-process, I think there is a ticket or TODO item for that also.
I think it may be very useful to have a vmtouch parameter that enforces caching of the currently cached files of a given folder. For example, I don't want to enforce caching of my entire /usr/lib, which is about 1,4 GiB and contains lots of libraries almost never used. But I like to enforce caching the 170 MiB currently cached. This is useful for me, as some WordPress sites hosted on my server have plugins that do huge backups. I cannot really make sure these don't get cached. So these backups pollute the page cache and sometimes, even frequently used libraries get thrown out. vmtouch helps me a lot to keep the most important stuff inside the page cache. Thanks a lot for that.
I would like to see a parameter that prints the same as
-v
, just without all the files that are not cached at all i.e. that say0/x
. When I have a folder with 1000 files and only 5 pages cached, I want to find out which files are cached.Edit: Basically, the same as this:
vmtouch -v /bin/ | grep '\[.*O.*\]' --before-context=1
Okay, so grepping is easy, so maybe no extra option is necessary.