Doloops / mcachefs

mcachefs : Simple filesystem-based file cache based on fuse
64 stars 15 forks source link

Homebrew Free space management, ideas for cron job bash script maybe #6

Open Jieiku opened 5 years ago

Jieiku commented 5 years ago

I have implemented the use of this, and its saving me a ton of bandwidth, so thank you!

I tried like 5-6 different cache files systems, and this and pcachefs were the only ones that worked for me. They both work, but so far I prefer mcachefs, its c/c++ which I love, and also when I view lsof mcachefs only seems to use one entry for r3 file descriptor per file, but when I use pcachefs i see both a r3 and r4 per accessed file, this leads me to believe that mcachefs is doing a cleaner job.

So the next thing to figure out is how to best manage free space, so that the cache does not completely fill the hard drive.

I was thinking I could run a cron job that checks df -h or something similar to see what free space % is at. then if the space is above a given threshold then delete a file from cache that was accessed the longest time ago.

ls -ltuR /tmp/mcachefs/media_remotefs/cache

the only problem with that Idea is that it seems the atime is not updated for the files in the cache directory, instead the atime is getting updated on the files in the mount location.

I was thinking that maybe the script could get a list of files in the cache, then compare those with files in the mount location to determine which are actually cache files and get the atimes there.

Any ideas on this subject are appreciated!

If I can come up with a good idea for a solution, then I could just have the cron job run every 10 minutes or something

hradec commented 5 years ago

humm... the journal doesn't show accessed files either, right?

maybe we need some new code in mcachefs to show a new file in the .mcachefs folder, which would show a list of the cached files, with atime...

or maybe just update atime on the cache would be the simpler solution! LOL

I'm working on adding some stuff that I need to mcachefs, so I'll check for this since I'll be messing with the code anyways... I'll let you known!

jmanley commented 2 years ago

It's been a while since there was any action here, but I'm also interested in a feature to manage/limit the data cached. Any further thoughts on this?