vcache-0.2.6: semi-transparent persistence for Haskell using LMDB, STM

Safe HaskellNone
LanguageHaskell2010

Database.VCache.VCacheable

Synopsis

Documentation

class Typeable a => VCacheable a where Source

To be utilized with VCache, a value must be serializable as a simple sequence of binary data and child VRefs. Also, to put then get a value must result in equivalent values. Further, values are Typeable to support memory caching of values loaded.

Under the hood, structured data is serialized as the pair:

(ByteString,[Either VRef PVar])

Developers must ensure that get on the serialization from put returns the same value. And get must be backwards compatible. Developers should consider version wrappers, cf. SafeCopy package.

Methods

put :: a -> VPut () Source

Serialize a value as a stream of bytes and value references.

get :: VGet a Source

Parse a value from its serialized representation into memory.