snap-app-0.5.0: Simple modules for writing apps with Snap, abstracted from hpaste.

Safe HaskellNone

Snap.App.Cache

Description

Caching of Blaze HTML pages caching.

Synopsis

Documentation

cache :: (CacheDir c, Key key) => key -> Controller c s (Maybe Markup) -> Controller c s (Maybe Text)Source

Generate and save into the cache, or retrieve existing from the | cache.

cacheIf :: (CacheDir c, Key key) => Bool -> key -> Controller c s (Maybe Markup) -> Controller c s (Maybe Text)Source

Cache conditionally.

resetCache :: (CacheDir c, Key key) => key -> Controller c s ()Source

Reset an item in the cache.

clearCache :: CacheDir c => c -> IO ()Source

Clear the whole cache.

resetCacheModel :: (CacheDir c, Key key) => key -> Model c s ()Source

Reset an item in the cache.

viewCached :: (CacheDir c, Key key) => key -> Controller c s Markup -> Controller c s ()Source

View some HTML generator cached.

class Key key whereSource

A key for the cache.

Methods

keyToString :: key -> FilePathSource

class CacheDir config whereSource

A config that can return a cache directory.

Methods

getCacheDir :: config -> FilePathSource