summaryrefslogtreecommitdiff
path: root/src/Text/Hakyll/Internal
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2010-01-21 09:19:14 +0100
committerJasper Van der Jeugt <jaspervdj@gmail.com>2010-01-21 09:19:14 +0100
commitaaa777180948074f2d65a23aedc4f7fc7e3d4761 (patch)
treea72e1dfe09331bffca723042e67abb450429af4d /src/Text/Hakyll/Internal
parentcf789c7ac677b9c13ae6f26d7dda950584a373c8 (diff)
downloadhakyll-aaa777180948074f2d65a23aedc4f7fc7e3d4761.tar.gz
Some more documentation.
Diffstat (limited to 'src/Text/Hakyll/Internal')
-rw-r--r--src/Text/Hakyll/Internal/Cache.hs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/Text/Hakyll/Internal/Cache.hs b/src/Text/Hakyll/Internal/Cache.hs
index 9b9fab1..d28f849 100644
--- a/src/Text/Hakyll/Internal/Cache.hs
+++ b/src/Text/Hakyll/Internal/Cache.hs
@@ -8,12 +8,18 @@ import Text.Hakyll.Hakyll (Hakyll)
import Text.Hakyll.File
import Data.Binary
+-- | We can store all datatypes instantiating @Binary@ to the cache. The cache
+-- directory is specified by the @HakyllConfiguration@, usually @_cache@.
storeInCache :: (Binary a) => a -> FilePath -> Hakyll ()
storeInCache value path = do
cachePath <- toCache path
makeDirectories cachePath
liftIO $ encodeFile cachePath value
+-- | Get a value from the cache. The filepath given should not be located in the
+-- cache. This function performs a timestamp check on the filepath and the
+-- filepath in the cache, and only returns the cached value when it is still
+-- up-to-date.
getFromCache :: (Binary a) => FilePath -> Hakyll (Maybe a)
getFromCache path = do
cachePath <- toCache path