sprinkles-0.6.0.0: JSON API to HTML website wrapper

Safe HaskellNone
LanguageHaskell2010

Web.Sprinkles.Cache

Synopsis

Documentation

data Cache k v Source #

Common interface for cache backends. In Cache k v, k is the key type and v the value type.

Constructors

Cache 

Fields

Instances
Semigroup (Cache k v) Source # 
Instance details

Defined in Web.Sprinkles.Cache

Methods

(<>) :: Cache k v -> Cache k v -> Cache k v #

sconcat :: NonEmpty (Cache k v) -> Cache k v #

stimes :: Integral b => b -> Cache k v -> Cache k v #

Monoid (Cache k v) Source # 
Instance details

Defined in Web.Sprinkles.Cache

Methods

mempty :: Cache k v #

mappend :: Cache k v -> Cache k v -> Cache k v #

mconcat :: [Cache k v] -> Cache k v #

cacheFetch :: (k -> IO v) -> Cache k v -> k -> IO v Source #

cacheFetch load cache key fetches a value at the key from the cache, failing over to the load action when the key is not present in the cache, and adding it to the cache.

cached :: Cache k v -> (k -> IO v) -> k -> IO v Source #

nullCache :: Cache k v Source #

A cache that doesn't actually cache anything

appendCache :: Cache k v -> Cache k v -> Cache k v Source #

transformCache :: (k -> j) -> (j -> Maybe k) -> (v -> IO (Maybe u)) -> (u -> IO (Maybe v)) -> Cache j u -> Cache k v Source #

Wrap a cache such that the new cache uses different types for the keys and values, using the provided transformation functions. A typical application for this is to serialize data structures into a more palatable format for caching while exposing a more useful kind of data structure