More useful defaultClientSessionBackend
This commit is contained in:
parent
2d93157e9a
commit
cd2f0ed610
@ -237,7 +237,7 @@ class RenderRoute site => Yesod site where
|
|||||||
--
|
--
|
||||||
-- Default: Uses clientsession with a 2 hour timeout.
|
-- Default: Uses clientsession with a 2 hour timeout.
|
||||||
makeSessionBackend :: site -> IO (Maybe SessionBackend)
|
makeSessionBackend :: site -> IO (Maybe SessionBackend)
|
||||||
makeSessionBackend _ = fmap Just defaultClientSessionBackend
|
makeSessionBackend _ = fmap Just $ defaultClientSessionBackend 120 CS.defaultKeyFile
|
||||||
|
|
||||||
-- | How to store uploaded files.
|
-- | How to store uploaded files.
|
||||||
--
|
--
|
||||||
@ -493,10 +493,12 @@ formatLogMessage getdate loc src level msg = do
|
|||||||
, LB ")\n"
|
, LB ")\n"
|
||||||
]
|
]
|
||||||
|
|
||||||
defaultClientSessionBackend :: IO SessionBackend
|
defaultClientSessionBackend :: Int -- ^ minutes
|
||||||
defaultClientSessionBackend = do
|
-> FilePath -- ^ key file
|
||||||
key <- CS.getKey CS.defaultKeyFile
|
-> IO SessionBackend
|
||||||
let timeout = fromIntegral (120 * 60 :: Int) -- 120 minutes
|
defaultClientSessionBackend minutes fp = do
|
||||||
|
key <- CS.getKey fp
|
||||||
|
let timeout = fromIntegral (minutes * 60)
|
||||||
(getCachedDate, _closeDateCacher) <- clientSessionDateCacher timeout
|
(getCachedDate, _closeDateCacher) <- clientSessionDateCacher timeout
|
||||||
return $ clientSessionBackend key getCachedDate
|
return $ clientSessionBackend key getCachedDate
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user