Provides a general caching interface along with a simple in-memory (process only) and file based cache implementations.
- class Cache c where
- fetchOr :: (Cache c, MonadIO m) => c -> String -> m ByteString -> m ByteString
- data FileSystemCache
- newFileSystemCache :: FilePath -> FileSystemCache
- data InMemCache
- newInMemCache :: MonadIO m => m InMemCache
A class that captures a simple key-value caching interface. The keys are simply 'String'\'s and values are simply 'ByteString'\'s.
Store a value in the cache. The returned value should be the value that was just stored.
Retrieve a value from the cache.
Invalidate a potentially existing value in the cache. Depending on the implementation this may or may not free the space used by the key-value pair.
A file based cache implementation. Files are stored in subdirectories of
An in-memory cache implementation. The current processes heap space is simply used as the cache.