swapper-0.1: Transparently swapping data from in-memory structures to disk

Stabilityexperimental
MaintainerRoman Smr <roman.smrz@seznam.cz>

Data.Disk.Swapper.Cache

Description

Here is provided a Cache type class designed to generalize notion of cache currently used in Swapper.

Synopsis

Documentation

class Cache a v | a -> v whereSource

First parameter of this class is actual cache type, the second is type of cached values. The cache should just hold an reference to those values that are meant to be kept in memory.

Methods

addValue :: a -> v -> IO (IO ())Source

This function is called when new value is about to be added to the structure using the cache. It returns another IO action used for "refreshing"; i.e. which should be called whenever associated value is accessed, so the cache can adapt.

Instances

addValueRef :: Cache a v => IORef a -> v -> IO (IO ())Source

Version of addValue, which works with a cache in IORef.

data SomeCache v Source

Constructors

forall c . Cache c v => SomeCache !c 

Instances

data ClockCache a Source

Provides standard clock cache with second chance mechanism.

Constructors

ClockCache 

Fields

ccSize :: Int
 
ccData :: MVar [(IORef a, IORef Bool)]
 

data NullCache a Source

NullCache does not cache any values

Constructors

NullCache 

Instances