new method : flush expired cache
Closed this issue · 4 comments
mqu commented
hello Danny, would be nice to be able to remove expired keys files.
DannyBen commented
Yeah, should be easy. I am thinking maybe a prune
method?
DannyBen commented
Added. Do you want to test it before I release? If so, this should be in your Gemfile:
# Gemfile
source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
gem "lightly", github: 'DannyBen/lightly', branch: 'prune'
And this is a simple test case:
# test.rb
require 'lightly'
Lightly.life = '30s'
Lightly.get('key1') { 'content' }
sleep 30
Lightly.get('key2') { 'content' }
Lightly.prune
And then just run with bundle exec ruby test.rb
DannyBen commented
Released as 0.3.2.
mqu commented
thank you ; very good job.