1module Text.Hakyll.Internal.Cache
7import Control.Monad ((<=<))
8import Control.Monad.Reader (liftIO)
9import Text.Hakyll.Hakyll (Hakyll)
10import Text.Hakyll.File
13-- | We can store all datatypes instantiating @Binary@ to the cache. The cache
14-- directory is specified by the @HakyllConfiguration@, usually @_cache@.
15storeInCache :: (Binary a) => a -> FilePath -> Hakyll ()
16storeInCache value path = do
17 cachePath <- toCache path
18 makeDirectories cachePath
19 liftIO $ encodeFile cachePath value
21-- | Get a value from the cache. The filepath given should not be located in the
22-- cache. This function performs a timestamp check on the filepath and the
23-- filepath in the cache, and only returns the cached value when it is still
25getFromCache :: (Binary a) => FilePath -> Hakyll a
26getFromCache = liftIO . decodeFile <=< toCache
28-- | Check if a file in the cache is more recent than a number of other files.
29isCacheMoreRecent :: FilePath -> [FilePath] -> Hakyll Bool
30isCacheMoreRecent file depends = toCache file >>= flip isMoreRecent depends
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list