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
11 12 13 14 15 |
# File 'lib/tdiary/cache/file.rb', line 11 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
3 4 5 |
# File 'lib/tdiary/cache/file.rb', line 3 def restore_cache( prefix ) restore_data("#{cache_path}/#{cache_file( prefix )}") if cache_enable?( prefix ) end |
#store_cache(cache, prefix) ⇒ Object
7 8 9 |
# File 'lib/tdiary/cache/file.rb', line 7 def store_cache(cache, prefix) store_data(cache, "#{cache_path}/#{cache_file( prefix )}") if cache_file( prefix ) end |