Copyright | (c) 2014-2021 Amy de Buitléir |
---|---|
License | BSD-style |
Maintainer | amy@nualeargais.ie |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
A module containing private CachedFileSystem internals. Most developers should use CachedFileSystem instead. This module is subject to change without notice.
Synopsis
- data CachedFSDatabase r = CachedFSDatabase {
- database :: FSDatabase r
- cache :: [r]
- maxCacheSize :: Int
- withFSDB :: Monad m => StateT (FSDatabase r) m a -> StateT (CachedFSDatabase r) m a
- fromCache :: Record r => String -> StateT (CachedFSDatabase r) IO (Maybe r)
- addToCache :: SizedRecord r => r -> StateT (CachedFSDatabase r) IO ()
- deleteByKeyFromCache :: SizedRecord r => String -> StateT (CachedFSDatabase r) IO ()
- deleteFromCache :: SizedRecord r => r -> StateT (CachedFSDatabase r) IO ()
- trimCache :: SizedRecord r => StateT (CachedFSDatabase r) IO ()
- trim :: SizedRecord r => Int -> [r] -> [r]
- listSize :: SizedRecord r => [r] -> Int
- mkCachedFSDatabase :: FilePath -> Int -> CachedFSDatabase r
Documentation
data CachedFSDatabase r Source #
A simple database where each record is stored in a separate file, and the name of the file is the record's key.
CachedFSDatabase | |
|
Instances
withFSDB :: Monad m => StateT (FSDatabase r) m a -> StateT (CachedFSDatabase r) m a Source #
addToCache :: SizedRecord r => r -> StateT (CachedFSDatabase r) IO () Source #
deleteByKeyFromCache :: SizedRecord r => String -> StateT (CachedFSDatabase r) IO () Source #
deleteFromCache :: SizedRecord r => r -> StateT (CachedFSDatabase r) IO () Source #
trimCache :: SizedRecord r => StateT (CachedFSDatabase r) IO () Source #
trim :: SizedRecord r => Int -> [r] -> [r] Source #
listSize :: SizedRecord r => [r] -> Int Source #
mkCachedFSDatabase :: FilePath -> Int -> CachedFSDatabase r Source #
(re)creates the FSDatabase in the
directory mkFSDatabase
dd
.