Skip to content

Jinja templates are from disk... we are blocking? #1583

Answered by gnat
gnat asked this question in Potential Issue
Discussion options

You must be logged in to vote

Great responses! Can confirm your comments are accurate as of this writing.

Jinja's cache is a {} wrapped in LRUCache to do automatic expiration. To prevent automatic expiration, Jinja overrides it to {}: You just set the environment to negative cache_size=-1 setting seen here and here

Environment settings for max performance:

  • auto_reload=False will prevent Jinja from checking timestamps on-disk if the template is already in the cache.
  • cache_size=-1 will prevent Jinja from purging the cache. Safe if you have a set number of templates, otherwise a static value such as cache_size=10000 would be plenty; the Jinja default is 400.

With these set, I do also believe the benefit of async would …

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by gnat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants