simple-0.5.0: A minimalist web framework for the WAI server interface

Safe HaskellNone




Provides a general caching interface along with a simple in-memory (process only) and file based cache implementations.


Cache Interface

class Cache c whereSource

A class that captures a simple key-value caching interface. The keys are simply 'String'\'s and values are simply 'ByteString'\'s.


put :: MonadIO m => c -> String -> ByteString -> m ByteStringSource

Store a value in the cache. The returned value should be the value that was just stored.

fetch :: MonadIO m => c -> String -> m (Maybe ByteString)Source

Retrieve a value from the cache.

invalidate :: MonadIO m => c -> String -> m ()Source

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.

Cache Implementations

data FileSystemCache Source

A file based cache implementation. Files are stored in subdirectories of fsCacheBase.

newFileSystemCache :: FilePath -> FileSystemCacheSource

Create a new FileSystemCache.

data InMemCache Source

An in-memory cache implementation. The current processes heap space is simply used as the cache.


newInMemCache :: MonadIO m => m InMemCacheSource

Create a new InMemCache.