mirrors 修复缓存更新慢的问题

现在设置了 trigger,每个源同步完成后都会立即更新这个源的 cache,而不用等每天凌晨统一更新 cache 了。这使得缓存不一致的时间缩短到秒级。

此外,由于 rsync 同步不够灵活,全部删掉再重新复制又太浪费,我重新发明了轮子来做同步。算法见下面的注释:

# There are actually 3 file lists:
#  - cache_list: files to be cached (param 1 of this func)
#  - WWWROOT: authoritative source
#  - CACHEROOT: cache files
# After sync, CACHEROOT should contain up-to-date files in and only in the intersection of cache_list and WWWROOT.
# So comes the algorithm:
#  1. Remove files in CACHEROOT but not in cache_list
#  2. Remove files in CACHEROOT but not in WWWROOT or not up-to-date
#  3. Copy non-cached files in cache_list to CACHEROOT, if it exists in WWWROOT

完整的代码 git clone https://gitgeek.net/mirrors/ssd-cache.git