Class: Merb::Cache::FileStore

Class | Merb::Cache::FileStore
In: | lib/merb-cache/stores/fundamental/file_store.rb
Parent: | AbstractStore

Cache store that uses files. Usually this is good for fragment and page caching but not object caching.

By default cached files are stored in tmp/cache under Merb.root directory. To use other location pass :dir option to constructor.

File caching does not support expiration time.

### Methods

create_path delete delete_all exists? fetch new pathify read read_file writable? write write_file

### Attributes

dir | [RW] |

### Public Class methods

new(config = {})

Creates directory for cached files unless it exists.

### Public Instance methods

delete(key, parameters = {})

Deletes cached template by key using FileUtils#rm.

delete_all()
exists?(key, parameters = {})

Checks if cached template with given key exists.

fetch(key, parameters = {}, conditions = {}, &blk)

Fetches cached data by key if it exists. If it does not, uses passed block to get new cached value and writes it using given key.

pathify(key, parameters = {})
read(key, parameters = {})

Reads cached template from disk if it exists.

writable?(key, parameters = {}, conditions = {})

File caching does not support expiration time.

write(key, data = nil, parameters = {}, conditions = {})

Writes cached template to disk, creating cache directory if it does not exist.

### Protected Instance methods

create_path(path)
read_file(path)

Reads file content. Access to the file uses file locking.

write_file(path, data)

Writes file content. Access to the file uses file locking.

[Validate]