-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Cache for HXT XML Documents and other binary data -- -- Extension for caching XML documents and other binary data in cache -- directory of the local filesystem. @package hxt-cache @version 9.0.2 module Control.Concurrent.ResourceTable type ResourceTable a = MVar (Map a ResourceLock) type ResourceLock = (MVar (), Int) requestResource :: Ord a => ResourceTable a -> a -> IO () releaseResource :: Ord a => ResourceTable a -> a -> IO () newResourceTable :: IO (ResourceTable a) -- | Caching of XML document trees and other binary data module Text.XML.HXT.Arrow.XmlCache -- | withCache enables reading documents with caching. -- -- When the cache is configured and enabled, every document read and -- parsed is serialized and stored in binary form in the cache. When -- reading the same document again, it is just deserialized, no parsing -- is performed. -- -- The cache is configured by a path pointing to a directory for storing -- the documents, by a maximal time span in second for valid documents. -- After that time span, the documents are read again and the cache is -- updated. The flag contols, whether documents returning 404 or other -- errors will be cached. If set, the cache is even activated for 404 -- (not found) responses, default is false. -- -- The serialized documents can be compressed, e.g. with bzip, to save -- disk space and IO time. The compression can be configured by -- Text.XML.HXT.Arrow.XmlState.withCompression -- -- example: -- --
--   import Text.XML.HXT.Core
--   import Text.XML.HXT.Cache
--   import Codec.Compression.BZip (compress, decompress)
--   ...
--   readDocument [ withCache "/tmp/cache" 3600 False
--                , withCompression (compress, decompress)
--                , ....
--                ] "http://www.haskell.org/"
--   
-- -- In the example the document is read and stored in binary serialized -- form under /tmp/cache. The cached document remains valid for the next -- hour. It is compressed, before written to disk. withCache :: String -> Int -> Bool -> SysConfig -- | Disable use of cache withoutCache :: SysConfig -- | Predicate arrow for checking if a document is in the cache. The arrow -- fails if document not there or is not longer valid, else the file name -- is returned. isInCache :: IOStateArrow s String String lookupCache :: (NFData b, Binary b) => String -> IOStateArrow s a b readCache :: (NFData c, Binary c) => String -> IOStateArrow s b c writeCache :: Binary b => String -> IOStateArrow s b () -- | Compute the SHA1 hash is hexadecimal format for an arbitray -- serializable value sha1HashValue :: (Arrow a, Binary b) => a b Integer sha1HashString :: (Arrow a, Binary b) => a b String -- | Caching of XML document trees and other binary data module Text.XML.HXT.Cache -- | withCache enables reading documents with caching. -- -- When the cache is configured and enabled, every document read and -- parsed is serialized and stored in binary form in the cache. When -- reading the same document again, it is just deserialized, no parsing -- is performed. -- -- The cache is configured by a path pointing to a directory for storing -- the documents, by a maximal time span in second for valid documents. -- After that time span, the documents are read again and the cache is -- updated. The flag contols, whether documents returning 404 or other -- errors will be cached. If set, the cache is even activated for 404 -- (not found) responses, default is false. -- -- The serialized documents can be compressed, e.g. with bzip, to save -- disk space and IO time. The compression can be configured by -- Text.XML.HXT.Arrow.XmlState.withCompression -- -- example: -- --
--   import Text.XML.HXT.Core
--   import Text.XML.HXT.Cache
--   import Codec.Compression.BZip (compress, decompress)
--   ...
--   readDocument [ withCache "/tmp/cache" 3600 False
--                , withCompression (compress, decompress)
--                , ....
--                ] "http://www.haskell.org/"
--   
-- -- In the example the document is read and stored in binary serialized -- form under /tmp/cache. The cached document remains valid for the next -- hour. It is compressed, before written to disk. withCache :: String -> Int -> Bool -> SysConfig -- | Disable use of cache withoutCache :: SysConfig