-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A Transactional data cache with configurable persistence -- -- Data.Tcache is a transactional cache with configurable persistence. It -- tries to simulate Hibernate for Java or Rails for Ruby. The main -- difference is that transactions are done in memory trough STM. There -- are transactional cache implementations for some J2EE servers like -- JBOSS. TCache uses STM. It can atomically apply a function to a list -- of cached objects. The resulting objects go back to the cache -- (withResources). It also can retrieve these objects (getResources). -- Persistence can be syncronous (syncCache) or asyncronous, wtih -- configurable time between cache writes and configurable cache -- clearance strategy. the size of the cache can be configured too . All -- of this can be done trough clearSyncCacheProc. Even the TVar variables -- can be accessed directly (getTVar) to acceess all the semantic of -- atomic blocks while maintaining the persistence of the TVar updates. -- Persistence can be defined for each object: Each object must have a -- defined key, a default filename path (if applicable). Persistence is -- pre-defined in files, but the readResource writeResource and -- delResource methods can be redefined to persist in databases or -- whatever. There are Samples here that explain the main features. In -- this release: Added a Data.TCache.Dynamic. (SEE dynamicsample.hs) - -- Can handle, transact, and serialize to disk many datatypes -- simultaneously and incrementally - Dynamic uses the same interface -- than TCache and add *DResource(s) calls - Safe dynamic data handling -- trough a lighter, indexable and serializable version of Data.Dynamic - -- Added KEY object for retrieving any object of any type. @package TCache @version 0.5.5 module Data.TCache class IResource a serialize :: (IResource a) => a -> String deserialize :: (IResource a) => String -> a keyResource :: (IResource a) => a -> String defPath :: (IResource a) => a -> String readResource :: (IResource a) => a -> IO (Maybe a) writeResource :: (IResource a) => a -> IO () delResource :: (IResource a) => a -> IO () data Operation b Insert :: b -> Operation b Delete :: b -> Operation b type Cache a = IORef (Ht a, Integer) setCache :: Cache a -> IO () getTVars :: (IResource a) => [a] -> IO [Maybe (TVar a)] withResourcesID :: (IResource a) => [a] -> ([Maybe a] -> [Operation a]) -> IO () withResources :: (IResource a) => [a] -> ([Maybe a] -> [a]) -> IO () withResource :: (IResource a) => a -> (Maybe a -> a) -> IO () getResources :: (IResource a) => [a] -> IO [Maybe a] getResource :: (IResource a) => a -> IO (Maybe a) deleteResources :: (IResource a) => [a] -> IO () deleteResource :: (IResource a) => a -> IO () refcache :: Cache a syncCache :: (IResource a) => IORef (HashTable String (Block a), t) -> IO () clearSyncCacheProc :: (IResource a) => Cache a -> Int -> (Integer -> Integer -> Integer -> Bool) -> Int -> IO ThreadId defaultCheck :: Integer -> Integer -> Integer -> Bool readFileStrict :: FilePath -> IO [Char] module Data.TCache.Dynamic class IResource a serialize :: (IResource a) => a -> String deserialize :: (IResource a) => String -> a keyResource :: (IResource a) => a -> String defPath :: (IResource a) => a -> String readResource :: (IResource a) => a -> IO (Maybe a) writeResource :: (IResource a) => a -> IO () delResource :: (IResource a) => a -> IO () data Operation b Insert :: b -> Operation b Delete :: b -> Operation b setCache :: Cache a -> IO () refcache :: Cache a defaultCheck :: Integer -> Integer -> Integer -> Bool readFileStrict :: FilePath -> IO [Char] data IDynamic IDynamic :: a -> IDynamic type Cache a = IORef (Ht a, Integer) class DynamicInterface x toIDyn :: (DynamicInterface x) => x -> IDynamic registerType :: (DynamicInterface x) => IO x fromIDyn :: (DynamicInterface x) => IDynamic -> x unsafeFromIDyn :: (DynamicInterface x) => IDynamic -> x data Key Key :: String -> Key getDTVars :: [IDynamic] -> IO [Maybe (TVar IDynamic)] withDResource :: IDynamic -> (Maybe IDynamic -> IDynamic) -> IO () withDResources :: [IDynamic] -> ([Maybe IDynamic] -> [IDynamic]) -> IO () withDResourcesID :: [IDynamic] -> ([Maybe IDynamic] -> [Operation IDynamic]) -> IO () getDResource :: IDynamic -> IO (Maybe IDynamic) getDResources :: [IDynamic] -> IO [Maybe IDynamic] deleteDResource :: IDynamic -> IO () deleteDResources :: [IDynamic] -> IO () syncCache :: IO () clearSyncCacheProc :: Int -> (Integer -> Integer -> Integer -> Bool) -> Int -> IO ThreadId withResource :: (Typeable a, IResource a) => a -> (Maybe a -> a) -> IO () withResources :: (Typeable a, IResource a) => [a] -> ([Maybe a] -> [a]) -> IO () withResourcesID :: (Typeable a, IResource a) => [a] -> ([Maybe a] -> [Operation a]) -> IO () getResource :: (Typeable a, IResource a) => a -> IO (Maybe a) getResources :: (Typeable a, IResource a) => [a] -> IO [Maybe a] deleteResource :: (Typeable a, IResource a) => a -> IO () deleteResources :: (Typeable a, IResource a) => [a] -> IO () instance Typeable Key instance Typeable IDynamic instance IResource Key instance (IResource x, Typeable x) => DynamicInterface x instance Show IDynamic instance IResource IDynamic