summaryrefslogtreecommitdiff
path: root/src/server/Cache.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/Cache.hs')
-rw-r--r--src/server/Cache.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/server/Cache.hs b/src/server/Cache.hs
index d704fe495..8cb9135e2 100644
--- a/src/server/Cache.hs
+++ b/src/server/Cache.hs
@@ -1,4 +1,4 @@
-module Cache (Cache,newCache,readCache) where
+module Cache (Cache,newCache,flushCache,readCache) where
import Control.Concurrent.MVar
import Data.Map (Map)
@@ -17,6 +17,9 @@ newCache load =
do objs <- newMVar Map.empty
return $ Cache { cacheLoad = load, cacheObjects = objs }
+flushCache :: Cache a -> IO ()
+flushCache c = modifyMVar_ (cacheObjects c) (const (return Map.empty))
+
readCache :: Cache a -> FilePath -> IO a
readCache c file =
do v <- modifyMVar (cacheObjects c) findEntry