diff options
author | pacien | 2022-09-04 18:18:27 +0200 |
---|---|---|
committer | pacien | 2022-09-04 18:18:27 +0200 |
commit | 11bbbae2850b9c45da697a8ed9626495a50a38c0 (patch) | |
tree | ff2713118f8b45d36905bfea2933f08d8e70066d /compiler/src/Caching.hs | |
parent | e93f7b1eb84c083d67567115284c0002a3a7d5fc (diff) | |
parent | 8349be992b46b77dee921f484cfbff8b758ff756 (diff) | |
download | ldgallery-11bbbae2850b9c45da697a8ed9626495a50a38c0.tar.gz |
Merge branch 'develop': release v2.1v2.1
GitHub: related to #315
Diffstat (limited to 'compiler/src/Caching.hs')
-rw-r--r-- | compiler/src/Caching.hs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/src/Caching.hs b/compiler/src/Caching.hs index c2b5a43..1a8b710 100644 --- a/compiler/src/Caching.hs +++ b/compiler/src/Caching.hs | |||
@@ -53,7 +53,7 @@ buildItemCache cachedItems = lookupCache | |||
53 | cachedMap = Map.fromList (map withKey cachedItemList) | 53 | cachedMap = Map.fromList (map withKey cachedItemList) |
54 | lookupCache path = Map.lookup (webPath path) cachedMap | 54 | lookupCache path = Map.lookup (webPath path) cachedMap |
55 | 55 | ||
56 | useCached :: ItemCache -> (GalleryItem -> a) -> Cache a | 56 | useCached :: ItemCache -> (GalleryItem -> Maybe a) -> Cache a |
57 | useCached cache propGetter processor itemPath resPath inputFsPath outputFsPath = | 57 | useCached cache propGetter processor itemPath resPath inputFsPath outputFsPath = |
58 | do | 58 | do |
59 | isDir <- doesDirectoryExist outputFsPath | 59 | isDir <- doesDirectoryExist outputFsPath |
@@ -63,7 +63,7 @@ useCached cache propGetter processor itemPath resPath inputFsPath outputFsPath = | |||
63 | if fileExists then | 63 | if fileExists then |
64 | do | 64 | do |
65 | needUpdate <- isOutdated True inputFsPath outputFsPath | 65 | needUpdate <- isOutdated True inputFsPath outputFsPath |
66 | case (needUpdate, cache itemPath) of | 66 | case (needUpdate, cache itemPath >>= propGetter) of |
67 | (False, Just props) -> fromCache props | 67 | (False, Just props) -> fromCache props |
68 | _ -> update | 68 | _ -> update |
69 | else | 69 | else |
@@ -73,4 +73,4 @@ useCached cache propGetter processor itemPath resPath inputFsPath outputFsPath = | |||
73 | update = processor itemPath resPath inputFsPath outputFsPath | 73 | update = processor itemPath resPath inputFsPath outputFsPath |
74 | fromCache props = | 74 | fromCache props = |
75 | putStrLn ("From cache:\t" ++ outputFsPath) | 75 | putStrLn ("From cache:\t" ++ outputFsPath) |
76 | >> return (propGetter props) | 76 | >> return props |