License | GPLv2 or higher, see LICENSE.txt |
---|---|
Maintainer | Daniel Hackbarth <da_ha@uni-bremen.de> |
Safe Haskell | None |
Synopsis
- data RequestMapKey = RequestMapKey {
- requestMethod' :: Method
- pathInfo' :: [Text]
- requestBody' :: ByteString
- type RequestCacheMap = Map RequestMapKey Response
- createNewRequestCache :: IO (IORef RequestCacheMap)
- updateCache :: IORef ByteString -> Request -> Response -> IORef RequestCacheMap -> IO ()
- updateCacheWithKey :: RequestMapKey -> Response -> IORef RequestCacheMap -> IO ()
- lookupCache :: RequestMapKey -> IORef RequestCacheMap -> IO (Maybe Response)
- convertRequestToMapKey :: Request -> ByteString -> IO RequestMapKey
Documentation
data RequestMapKey Source #
Holds all necessary informations for caching a request
RequestMapKey | |
|
Instances
Eq RequestMapKey Source # | |
Defined in PGIP.RequestCache (==) :: RequestMapKey -> RequestMapKey -> Bool (/=) :: RequestMapKey -> RequestMapKey -> Bool | |
Ord RequestMapKey Source # | |
Defined in PGIP.RequestCache compare :: RequestMapKey -> RequestMapKey -> Ordering (<) :: RequestMapKey -> RequestMapKey -> Bool (<=) :: RequestMapKey -> RequestMapKey -> Bool (>) :: RequestMapKey -> RequestMapKey -> Bool (>=) :: RequestMapKey -> RequestMapKey -> Bool max :: RequestMapKey -> RequestMapKey -> RequestMapKey min :: RequestMapKey -> RequestMapKey -> RequestMapKey | |
Show RequestMapKey Source # | |
Defined in PGIP.RequestCache showsPrec :: Int -> RequestMapKey -> ShowS show :: RequestMapKey -> String showList :: [RequestMapKey] -> ShowS |
type RequestCacheMap = Map RequestMapKey Response Source #
createNewRequestCache :: IO (IORef RequestCacheMap) Source #
Returns a new request cache.
updateCache :: IORef ByteString -> Request -> Response -> IORef RequestCacheMap -> IO () Source #
Update the request cache by first building the key and then perform the update
updateCacheWithKey :: RequestMapKey -> Response -> IORef RequestCacheMap -> IO () Source #
Update the request cache with a new request/response pair.
lookupCache :: RequestMapKey -> IORef RequestCacheMap -> IO (Maybe Response) Source #
Checks the request cache for a request that could already be cached. Returns the cached response or Nothing if the request is not cached.
convertRequestToMapKey :: Request -> ByteString -> IO RequestMapKey Source #
Converts a given request to a key that can be used for a request cache. The original request body needs to be passed too because in the original request the request body is already consumed.