Rename enableCache() to initCache() to make code easier to understand

This commit is contained in:
Tim Donohue
2023-01-10 08:53:46 -06:00
parent f9810493c3
commit 048e5b012d

View File

@@ -93,12 +93,12 @@ export function app() {
/* /*
* If production mode is enabled in the environment file: * If production mode is enabled in the environment file:
* - Enable Angular's production mode * - Enable Angular's production mode
* - Enable caching of SSR rendered pages (if enabled in config.yml) * - Initialize caching of SSR rendered pages (if enabled in config.yml)
* - Enable compression for SSR reponses. See [compression](https://github.com/expressjs/compression) * - Enable compression for SSR reponses. See [compression](https://github.com/expressjs/compression)
*/ */
if (environment.production) { if (environment.production) {
enableProdMode(); enableProdMode();
enableCache(); initCache();
server.use(compression({ server.use(compression({
// only compress responses we've marked as SSR // only compress responses we've marked as SSR
// otherwise, this middleware may compress files we've chosen not to compress via compression-webpack-plugin // otherwise, this middleware may compress files we've chosen not to compress via compression-webpack-plugin
@@ -310,9 +310,9 @@ function addCacheControl(req, res, next) {
} }
/* /*
* Enable server-side caching of pages rendered via SSR. * Initialize server-side caching of pages rendered via SSR.
*/ */
function enableCache() { function initCache() {
if (cacheEnabled()) { if (cacheEnabled()) {
// Initialize a new "least-recently-used" item cache (where least recently used items are removed first) // Initialize a new "least-recently-used" item cache (where least recently used items are removed first)
// See https://www.npmjs.com/package/lru-cache // See https://www.npmjs.com/package/lru-cache