1
0
mirror of https://github.com/trambarhq/relaks-wordpress-example.git synced 2025-09-30 09:19:30 +02:00

Implemented cache status page (issue #39).

This commit is contained in:
Chung Leong
2019-01-29 22:02:21 +01:00
parent d24cc2cc1a
commit 3e60897e8c
2 changed files with 33 additions and 2 deletions

View File

@@ -58,11 +58,11 @@ let cacheEntryCache = {};
async function loadCacheEntry(md5) {
try {
let path = `${NGINX_CACHE}/${md5}`;
let { mtime } = await FS.statAsync(path);
let { mtime, size } = await FS.statAsync(path);
let entry = cacheEntryCache[md5];
if (!entry || entry.mtime !== mtime) {
let url = await loadCacheEntryKey(path);
entry = cacheEntryCache[md5] = { url, mtime, md5 };
entry = cacheEntryCache[md5] = { url, md5, mtime, size };
}
return entry;
} catch (err) {
@@ -98,4 +98,5 @@ async function removeCacheEntry(entry) {
module.exports = {
purge,
read: loadCacheEntries,
};