caching - Clearing expired cache entries from disk cache on Ruby on Rails 4 -
i have rails app uses disk cache default russian-doll caching. have no trouble invalidating cache , cache strategy working requirements, have find proper way delete expired entries disk. documented disk cache keeps on growing until either cleared or disk full.
i'm aware can rake tmp:cache:clear
deletes entire cache, not stale items! i'm looking better way preserve fresh entries , delete disk stale cached entries. i'm using shell script delete entries have not been accessed in last day not guarantee i'm deleting stale entries , preserving fresh entries.
i aware can switch memcached or redis, prefer not to, disk cache doing fine job without overhead of resources , supporting yet server (server in terms of server process, not actual hardware/virtual-machine).
how clear stale cache entries when using disk cache? there better way using files' atime/mtime?
according documentation, might use #cleanup http://api.rubyonrails.org/classes/activesupport/cache/filestore.html#method-i-cleanup
you could, example, schedule cron job run periodically on hosts ./script/rails runner -e production 'rails.cache.cleanup'
Comments
Post a Comment