heist-0.8.2: An (x)html templating system

Safe HaskellNone

Text.Templating.Heist.Splices.Cache

Description

The "cache" splice ensures that its contents are cached and only evaluated periodically. The cached contents are returned every time the splice is referenced.

Use the ttl attribute to set the amount of time between reloads. The ttl value should be a positive integer followed by a single character specifying the units. Valid units are seconds, minutes, hours, days, and weeks. If the ttl string is invalid or the ttl attribute is not specified, the cache is never refreshed unless explicitly cleared with clearCacheTagState.

Synopsis

Documentation

data CacheTagState Source

State for storing cache tag information

mkCacheTag :: MonadIO m => IO (HeistState m -> HeistState m, CacheTagState)Source

Returns a function that modifies a HeistState to include a "cache" tag. The cache tag is not bound automatically with the other default Heist tags. This is because this function also returns CacheTagState, so the user will be able to clear it with the clearCacheTagState function.

clearCacheTagState :: CacheTagState -> IO ()Source

Clears the cache tag state.