-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A Linux-only cache system associating values to files. -- @package filecache @version 0.2.7 -- | This module let you create caches where keys are file names, and -- values are automatically expired when the file is modified for any -- reason. -- -- This is usually done in the following fashion : -- --
-- cache <- newFileCache -- o <- query cache "/path/to/file" computation ---- -- The computation will be used to populate the cache if this call -- results in a miss. module Data.FileCache -- | A default type synonym, for String errors. type FileCache = FileCacheR String -- | The main FileCache type, for queries returning 'Either r a'. The r -- type must be an instance of Error. data FileCacheR r a -- | Generates a new file cache. The opaque type is for use with other -- functions. newFileCache :: IO (FileCacheR r a) -- | Destroys the thread running the FileCache. Pretty dangerous stuff. killFileCache :: FileCacheR r a -> IO () -- | Manually invalidates an entry. invalidate :: FilePath -> FileCacheR e a -> IO () -- | Queries the cache, populating it if necessary, returning a strict -- Either (from Data.Either.Strict). -- -- Queries that fail with an IOExeception will not create a -- cache entry. Also please note that there is a race condition between -- the potential execution of the computation and the establishment of -- the watch. query :: IsString e => FileCacheR e a -> FilePath -> IO (Either e a) -> IO (Either e a) -- | Gets a copy of the cache. getCache :: FileCacheR e a -> IO (HashMap FilePath (Either e a, WatchDescriptor)) -- | Just like query, but with the standard Either type. lazyQuery :: IsString r => FileCacheR r a -> FilePath -> IO (Either r a) -> IO (Either r a)