class Webgen::Cache

A cache object provides access to various caches to speed up rendering of a website:

permanent

The permanent cache should be used for data that should be available between webgen runs.

volatile

The volatile cache is used for data that can easily be regenerated but might be expensive to do so. This cache is not stored between passes when writing nodes to the destination.

standard

The standard cache saves data between webgen runs and returns the cached data (not the newly set data) if it is available. This is useful, for example, to store file modifcation times and check if a file has been changed between runs.

The standard cache should be accessed through the [] method which returns the correct value and the []= method should be used for setting the new value. However, if you really need to access a particular value of the old or new standard cache, you can use the accessors old_data and new_data.

Attributes

new_data[R]

The cache data stored in the current webgen run.

old_data[R]

The cache data stored in the previous webgen run.

permanent[R]

The permanent cache hash.

volatile[R]

The volatile cache hash.

Public Class Methods

new()

Create a new cache object.

Public Instance Methods

[](key)

Return the cached data (or, if it is not available, the new data) identified by key from the standard cache.

[]=(key, value)

Store value identified by key in the standard cache.

dump()

Return all caches that should be available between webgen runs.

reset_volatile_cache()

Reset the volatile cache.

restore(data)

Restore the cache from data.