Class RGen::Util::FileCacheMap
In: lib/rgen/util/file_cache_map.rb
Parent: Object

Implements a cache for storing and loading data associated with arbitrary files. The data is stored in cache files within a subfolder of the folder where the associated files exists. The cache files are protected with a checksum and loaded data will be invalid in case either the associated file are the cache file has changed.

Methods

Attributes

version_info  [RW]  optional program version info to be associated with the cache files if the program version changes, cached data will also be invalid

Public Class methods

cache_dir is the name of the subfolder where cache files are created postfix is an extension appended to the original file name for creating the name of the cache file

Public Instance methods

remove cache files which are not associated with any file in key_paths will only remove files within root_path

load data associated with file key_path returns :invalid in case either the associated file or the cache file has changed

options:

 :invalidation_reasons:
   an array which will receive symbols indicating why the cache is invalid:
   :no_cachefile, :cachefile_corrupted, :keyfile_changed

store data value_data associated with file key_path

[Validate]