Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


tmpfs, to clean every x min files older than x min
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

tmpfs, to clean every x min files older than x min

johnnymattjohnnymatt Member
edited February 2017 in Help

Im just doing some tests.

To setup a cron job to purge outdated cache files that are more than 8 minutes old every 10 minutes on disk its an easy task.

*/10 * * * * root find /tmp/diskcache -type f -mmin +8 -delete 2>/dev/null

I want to move diskcache to tmpfs. My idea with tmpfs (otherwise tmpfs eat half ram of default) is:

/etc/fstab
tmpfs /dev/diskcache tmpfs nodev,nosuid,size=2G 0 0

The new cron will be (correct?) but, most important, is it the best approach ?

*/10 * * * * root find /dev/diskcache -type f -mmin +8 -delete 2>/dev null

Thanks :)

Comments

  • Probably depends what is cached there. Pruning every 10 minutes files older than 8 min makes lifetime of the cached something between 10 and 18 minutes which seems quite a range, but rather short at all...

    Also keep in mind that the linux filecache usually works very well and there shouldn't really be a need to try and circumvent or replace it.

  • Its a test about private cache (OpenLitespeed, Cache Module) so i dont need to cache object for a long time because everything is cached for a single person.
    My goal was to try to find out (and correctly ofc) if this is a good approach to lower server load after the classic "tricks".
    Anyway i wrote something .... meeeh... :) Not /dev/ ! :) (http://www.tldp.org/LDP/sag/html/dev-fs.html) but maybe /tmp/diskcache
    Lol :)

Sign In or Register to comment.