Verified Commit b96d0b44 authored by Aral Balkan's avatar Aral Balkan
Browse files

Now using cache on production also

(We use the content cache to calculate the diff of blocker rule changes between deployments and expose this information in the metadata.json file.)
parent 5ba1e35a
......@@ -122,31 +122,24 @@ class Blockdown
new (winston.transports.File)({ filename: logFile, level: 'debug' })
]
# Decide cache policy
@decideCachePolicy()
# Setup cache
@setupCache()
# @log.debug "Blockdown initiated. Logs at #{logFile}"
#
# Should we use the cache?
# Setup cache.
#
# Currently, we only use the cache to render the Blockdown (Markdown) content
# if the theme hasn’t changed.
# We are now using the cache both during development and production as we
# use the content cache to calculate the diff of changes since the last
# deployment.
#
# TODO: Once we’ve separated and optimised content and theme rendering, we can implement
# ===== caching for the template also.
#
decideCachePolicy: =>
setupCache: =>
#
# Note: I do not trust the cache for use in production so we detect that and turn it off.
# ===== A production deployment should always do a full, clean build.
#
if app.isRunningInProduction
console.log "\t✓ Better is running in production, not using the cache feature."
@useContentCache == false
return
cacheDirectory = path.join app.homeDirectory, '.private', 'cache'
themeCacheCurrentModifiedTimesFile = path.join cacheDirectory, 'current-modified-times', 'themes.json'
themeCachePreviousModifiedTimesFile = path.join cacheDirectory, 'previous-modified-times', 'themes.json'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment