Module: TDiary::Cache
- Included in:
- IO::Default
- Defined in:
- lib/tdiary/cache/file.rb,
lib/tdiary/environment.rb
Instance Method Summary collapse
- #clear_cache(target = /.*/) ⇒ Object
- #restore_cache(prefix) ⇒ Object
- #store_cache(cache, prefix) ⇒ Object
Instance Method Details
#clear_cache(target = /.*/) ⇒ Object
13 14 15 16 17 |
# File 'lib/tdiary/cache/file.rb', line 13 def clear_cache( target = /.*/ ) Dir::glob( "#{cache_path}/*.r[bh]*" ).each do |c| delete_data(c) if target =~ c end end |
#restore_cache(prefix) ⇒ Object
5 6 7 |
# File 'lib/tdiary/cache/file.rb', line 5 def restore_cache( prefix ) restore_data("#{cache_path}/#{cache_file( prefix )}") if cache_enable?( prefix ) end |
#store_cache(cache, prefix) ⇒ Object
9 10 11 |
# File 'lib/tdiary/cache/file.rb', line 9 def store_cache(cache, prefix) store_data(cache, "#{cache_path}/#{cache_file( prefix )}") if cache_file( prefix ) end |