improve caching of images

First, we used two caches. Turns out that lru_cache wasn't needed, the
dict works perfectly fine on it's own.

Second, we now also cache local images, so that we don't have to read
them off the filesystem and convert them to base64 on every keystroke

Maybe there should be a maximum size on that cache dict, but I doubt
anyone would actually run into any trouble this cache taking too much
ram.
This commit is contained in:
Mathieu PATUREL
2019-11-16 10:07:15 +11:00
parent 2785df74ce
commit 192f61bf0c
3 changed files with 26 additions and 21 deletions

View File

@ -23,5 +23,4 @@ in `MarkdownLivePreview.py` and `markdown2html.py` (GitHub only shows the top
3. All your code should be formated by black.
4. Send a PR!
FIXME: add a git hook to format using black (can the git hook be added on github?)