cookutils rev 869

modules/compressor: auto-clean the cache.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Mon Jan 23 11:16:27 2017 +0200 (2017-01-23)
parents 9e870e53cac9
children 088359ca2353
files modules/compressor
line diff
     1.1 --- a/modules/compressor	Sun Jan 22 16:18:08 2017 +0200
     1.2 +++ b/modules/compressor	Mon Jan 23 11:16:27 2017 +0200
     1.3 @@ -10,13 +10,14 @@
     1.4  # Compressor cache stuff
     1.5  
     1.6  comp_cache_root='/var/cache/cook'
     1.7 +mkdir -p "$comp_cache_root"
     1.8  cache_stat=$(mktemp)
     1.9  
    1.10  # Cache notes.
    1.11  # Do not do the same job twice. Getting the file from the cache is much faster
    1.12  # than compressing the file one more time. In addition, this cache is trying not
    1.13  # to take extra space, using the hardlinks. Although the files from the cache
    1.14 -# without reference to himself should be removed periodically (to be done).
    1.15 +# without reference to himself should be removed periodically.
    1.16  
    1.17  
    1.18  
    1.19 @@ -570,3 +571,4 @@
    1.20  
    1.21  # Clean
    1.22  rm "$cache_stat"
    1.23 +find $comp_cache_root -type f -links -2 -delete