Safe Haskell | None |
---|---|
Language | Haskell2010 |
Internal module ... use at your own risks!
- data FileCacheR r a = FileCache {
- _cache :: TVar (Map FilePath (Either r a))
- _watchedDirs :: TVar (Map FilePath (Set FilePath, StopListening))
- _manager :: WatchManager
- _channel :: EventChannel
- _tid :: TVar (Maybe ThreadId)
- type FileCache = FileCacheR String
- newFileCache :: IO (FileCacheR r a)
- killFileCache :: FileCacheR r a -> IO ()
- invalidate :: FilePath -> FileCacheR e a -> IO ()
- canon :: FilePath -> IO FilePath
- query :: forall e a. IsString e => FileCacheR e a -> FilePath -> IO (Either e a) -> IO (Either e a)
- lazyQuery :: IsString r => FileCacheR r a -> FilePath -> IO (Either r a) -> IO (Either r a)
- getCache :: FileCacheR e a -> IO (Map FilePath (Either e a))
Documentation
data FileCacheR r a Source #
The main FileCache type, for queries returning 'Either r a'. The r
type must be an instance of Error
.
type FileCache = FileCacheR String Source #
A default type synonym, for String errors.
newFileCache :: IO (FileCacheR r a) Source #
Generates a new file cache. The opaque type is for use with other functions.
killFileCache :: FileCacheR r a -> IO () Source #
Destroys the thread running the FileCache. Pretty dangerous stuff.
invalidate :: FilePath -> FileCacheR e a -> IO () Source #
Manually invalidates an entry.
:: IsString e | |
=> FileCacheR e a | |
-> FilePath | Path of the file entry |
-> IO (Either e a) | The computation that will be used to populate the cache |
-> IO (Either e a) |
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.