From 1b42c652941498df006566c40001836f3b2673dd Mon Sep 17 00:00:00 2001 From: Peter Cai Date: Thu, 9 Apr 2020 17:18:52 +0800 Subject: [PATCH] blog: add more comment on PostContentCache --- src/blog.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/blog.rs b/src/blog.rs index e46c19a..ba8abbe 100644 --- a/src/blog.rs +++ b/src/blog.rs @@ -124,6 +124,16 @@ const CACHE_VERSION: &'static str = "0001"; // Cached version of rendered blog content HTMLs // compiled from Markdown +// This is needed because +// (1) we have to extract some information from +// the Markdown source code before anyone +// visits, e.g. pictures it refers to ( +// for whitelisting the cache URL) +// (2) Markdown parsing is slower than filling in +// HTML templates of the entire page. If these +// Markdown compilation results are cached, +// page generation can be very fast while still +// keeping some dynamic features available to us #[derive(Serialize, Deserialize)] pub struct PostContentCache { // UUID of the original post