TCache-0.13.3: A Transactional cache with user-defined persistence
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Persistent.Collection

Description

A persistent, transactional collection with Queue interface as well as indexed access by key.

Uses default persistence. See Data.TCache.DefaultPersistence

Synopsis

Documentation

type RefQueue a = DBRef (Queue a) Source #

A queue reference

getQRef :: (Typeable a, Serialize a) => String -> RefQueue a Source #

Get the reference to new or existing queue trough its name

pop Source #

Arguments

:: (Typeable a, Serialize a) 
=> RefQueue a

Queue name

-> IO a

the returned elems

Read the first element in the queue and delete it (pop)

popSTM :: (Typeable a, Serialize a) => RefQueue a -> STM a Source #

Version in the STM monad

pick Source #

Arguments

:: (Typeable a, Serialize a) 
=> RefQueue a

Queue name

-> IO a

the returned elems

flush :: (Typeable a, Serialize a) => RefQueue a -> IO () Source #

Empty the queue (factually, it is deleted)

flushSTM :: (Typeable a, Serialize a) => RefQueue a -> STM () Source #

Version in the STM monad

pickAll :: (Typeable a, Serialize a) => RefQueue a -> IO [a] Source #

Return the list of all elements in the queue. The queue remains unchanged

pickAllSTM :: (Typeable a, Serialize a) => RefQueue a -> STM [a] Source #

Version in the STM monad

push :: (Typeable a, Serialize a) => RefQueue a -> a -> IO () Source #

Push an element in the queue

pushSTM :: (Typeable a, Serialize a) => RefQueue a -> a -> STM () Source #

Version in the STM monad

pickElem :: (Indexable a, Typeable a, Serialize a) => RefQueue a -> String -> IO (Maybe a) Source #

Return the first element in the queue that has the given key

pickElemSTM :: (Indexable a, Typeable a, Serialize a) => RefQueue a -> String -> STM (Maybe a) Source #

Version in the STM monad

readAll :: (Typeable a, Serialize a) => RefQueue a -> IO [a] Source #

Return the list of all elements in the queue and empty it

readAllSTM :: (Typeable a, Serialize a) => RefQueue a -> STM [a] Source #

A version in the STM monad

deleteElem :: (Indexable a, Typeable a, Serialize a) => RefQueue a -> a -> IO () Source #

Delete all the elements of the queue that has the key of the parameter passed

deleteElemSTM :: (Typeable a, Serialize a, Indexable a) => RefQueue a -> a -> STM () Source #

Version in the STM monad

updateElem :: (Indexable a, Typeable a, Serialize a) => RefQueue a -> a -> IO () Source #

Update the first element of the queue with a new element with the same key

updateElemSTM :: (Indexable a, Typeable a, Serialize a) => RefQueue a -> a -> STM () Source #

Version in the STM monad

unreadSTM :: (Typeable a, Serialize a) => RefQueue a -> a -> STM () Source #

push an element at the top of the queue

isEmpty :: (Typeable a, Serialize a) => RefQueue a -> IO Bool Source #

Check if the queue is empty