Portability | portable |
---|---|
Stability | experimental |
Maintainer | Uwe Schmidt (uwe@fh-wedel.de) |
Caching of XML document trees and other binary data
- readDocument :: Attributes -> String -> IOStateArrow s b XmlTree
- a_cache :: String
- a_compress :: String
- a_document_age :: String
- lookupCache :: (NFData b, Binary b) => CacheConfig -> String -> IOStateArrow s a b
- writeCache :: Binary b => CacheConfig -> String -> IOStateArrow s b ()
- sha1HashValue :: (Arrow a, Binary b) => a b Integer
- sha1HashString :: (Arrow a, Binary b) => a b String
- data CacheConfig = CC {}
- isInCache :: Attributes -> IOStateArrow s String ClockTime
- isInCache' :: CacheConfig -> String -> IO (Maybe ClockTime)
Documentation
readDocument :: Attributes -> String -> IOStateArrow s b XmlTreeSource
This readDocument is a wrapper for the Text.XML.HXT.Arrow.ReadDocument.readDocument
function.
The function is controlled by the options a_cache
, a_compress
and a_document_age
.
-
a_cache
: the document tree of the document read is cached in the directory given by this option, or, if it is read before and it is not out of date, seea_document_age
, it is read from the cache. The document is stored in binary format (used package: binary). -
a_compress
: controls whether the cache contents is compressed with the bzip2 lib for saving space -
a_document_age
: determines the maximum age of the document in seconds. If this time is exceeded, the cache entry is ignored, the original is re-read and cached again. Default for the document age is 1 day.
lookupCache :: (NFData b, Binary b) => CacheConfig -> String -> IOStateArrow s a bSource
writeCache :: Binary b => CacheConfig -> String -> IOStateArrow s b ()Source
sha1HashValue :: (Arrow a, Binary b) => a b IntegerSource
Compute the SHA1 hash is hexadecimal format for an arbitray serializable value
sha1HashString :: (Arrow a, Binary b) => a b StringSource
data CacheConfig Source
isInCache :: Attributes -> IOStateArrow s String ClockTimeSource
Arrow for checking if a document is in the cache. The arrow fails if document not there, else the file modification time is returned.
isInCache' :: CacheConfig -> String -> IO (Maybe ClockTime)Source