diff options
Diffstat (limited to 'src/server/Cache.hs')
| -rw-r--r-- | src/server/Cache.hs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/server/Cache.hs b/src/server/Cache.hs index 8cb9135e2..d7c806783 100644 --- a/src/server/Cache.hs +++ b/src/server/Cache.hs @@ -1,4 +1,4 @@ -module Cache (Cache,newCache,flushCache,readCache) where +module Cache (Cache,newCache,flushCache,readCache,readCache') where import Control.Concurrent.MVar import Data.Map (Map) @@ -21,7 +21,10 @@ flushCache :: Cache a -> IO () flushCache c = modifyMVar_ (cacheObjects c) (const (return Map.empty)) readCache :: Cache a -> FilePath -> IO a -readCache c file = +readCache c file = snd `fmap` readCache' c file + +readCache' :: Cache a -> FilePath -> IO (UTCTime,a) +readCache' c file = do v <- modifyMVar (cacheObjects c) findEntry modifyMVar v readObject where @@ -35,4 +38,4 @@ readCache c file = x' <- case m of Just (t,x) | t' == t -> return x _ -> cacheLoad c file - return (Just (t',x'), x') + return (Just (t',x'), (t',x')) |
