wai-middleware-cache-redis-0.4.0: Redis backend for wai-middleware-cache

Safe HaskellSafe-Infered

Network.Wai.Middleware.Cache.Redis

Contents

Description

Redis backend for Network.Wai.Middleware.Cache.

This backend uses Database.Redis.Pile for low-lewel operations. Main drawback of this backend is the fact that whole response will be consumed in memory.

 cache
     (redisBackend 
         -- use defaults, DB 0 and "myprefix" 
         R.defaultConnectInfo 0 
         "myprefix"         -- prefix for caching
         Nothing            -- no expiration
         ["mytag"]          -- one cache tag
         (rawPathInfo)      -- URL path as key 
         lookupETag         -- And find "If-None-Match"
     ) app -- our app

Synopsis

Cache backend

redisBackendSource

Arguments

:: ConnectInfo

Redis connection info.

-> Integer

Redis DB Index.

-> ByteString

Cache prefix for key and tags. See Database.Redis.Pile for details.

-> Integer

Cache TTL. Use Zero (0) for no expiration.

-> [ByteString]

Cache Tags. See Database.Redis.Pile for details.

-> (Request -> ByteString)

Cache key extraction function.

-> (Request -> Maybe ByteString)

ETag value extraction. To extract If-None-Match header use lookupETag. Use (const Nothing) for block 304-responses.

-> CacheBackend 

Redis backend for Network.Wai.Middleware.Cache.