Method: FileCache#initialize
- Defined in:
- lib/filecache.rb
#initialize(domain = "default", root_dir = "/tmp", expiry = 0, depth = 2) ⇒ FileCache
Create a new reference to a file cache system.
- domain
-
A string that uniquely identifies this caching system on the given host
- root_dir
-
The root directory of the cache file hierarchy The cache will be rooted at root_dir/domain/
- expiry
-
The expiry time for cache entries, in seconds. Use 0 if you want cached values never to expire.
- depth
-
The depth of the file tree storing the cache. Should be large enough that no cache directory has more than a couple of hundred objects in it
21 22 23 24 25 26 27 |
# File 'lib/filecache.rb', line 21 def initialize(domain = "default", root_dir = "/tmp", expiry = 0, depth = 2) @domain = domain @root_dir = root_dir @expiry = expiry @depth = depth > MAX_DEPTH ? MAX_DEPTH : depth FileUtils.mkdir_p(get_root) end |