MFlow-0.4.5.9: stateful, RESTful web framework

Safe HaskellNone

MFlow.Forms.Cache

Description

Composable cache and HTTP header directives. Intended to permit each widget to express his caching needs to the whole page The page will compile them and choose the most strict ones Autorefreshed, push and witerate'd widgets do not inherit the page rules. they must specify their own.

The composition rules are explained in the corresponding combinators. This is a work in progress

Synopsis

Documentation

resetCachePolicy :: (MonadState (MFlowState v) m, Monad m) => m ()Source

to delete all previous directives

setCachePolicy :: (MonadState (MFlowState v) m, Monad m) => m ()Source

return the composition of the current directives. Used by the page internally

noCache :: (MonadState (MFlowState v) m, MonadIO m) => m ()Source

add no-cache to the Cache-Control header directive. It deletes all expires and put max-age=0

It means that the widget need not to be cached

noCache' :: (MonadState (MFlowState v) m, MonadIO m) => ByteString -> m ()Source

add no-cache: string to the Cache-Control header directive

it deletes the header string (sensible cookies for example) from the data stored in the cache

noStore :: (MonadState (MFlowState v) m, MonadIO m) => m ()Source

add no-store to the Cache-Control header directive. It deletes expires and put max-age: 0

stronger kind of noCache. Not even store temporally

expires :: (MonadState (MFlowState v) m, MonadIO m) => ByteString -> m ()Source

add expires: string to the Cache-Control header directive. it deletes max-age Currently it takes the last one if many

The page will be cached until this date

maxAge :: (MonadState (MFlowState v) m, MonadIO m) => Int -> m ()Source

add max-age: seconds to the Cache-Control header directive. if there are more than one, it chooses the lower one

The page will be stored in the cache for that amount of seconds

private :: (MonadState (MFlowState v) m, MonadIO m) => m ()Source

add private to the Cache-Control header directive. it delete public if any

It means that the page that holds the widget must not be shared by other users.

public :: (MonadState (MFlowState v) m, MonadIO m) => m ()Source

add public to the Cache-Control header directive.

means that the cache can share the page content with other users.

sMaxAge :: (MonadState (MFlowState v) m, MonadIO m) => Int -> m ()Source

add sMaxAge seconds to the Cache-Control header directive. if many, chooses the minimum

specify the time to hold the page for intermediate caches: for example proxies and CDNs.

noTransform :: (MonadState (MFlowState v) m, MonadIO m) => m ()Source

add noTransform to the Cache-Control header directive.

Tell CDNs that the content should not be transformed to save space and so on

proxyRevalidate :: (MonadState (MFlowState v) m, MonadIO m) => m ()Source

add proxyRevalidate to the Cache-Control header directive.

The same than mustRevalidate, for shared caches (proxies etc)

etag :: (MonadState (MFlowState v) m, MonadIO m) => ByteString -> m ()Source

add etag string to the header directives.

it is a resource identifier for the page that substitutes the URL identifier

vary :: (MonadState (MFlowState v) m, MonadIO m) => ByteString -> m ()Source

add vary string to the header directives.

Usually the page add this identifier to the URL string, that is the default identifier So the same page with different etags will be cached and server separately