Skip to main content


New in version 1.12.0

A choice loader factory returning one of CachingChoiceLoader or ChoiceLoader depending on the given arguments.

loaders: List[BaseLoader],
auto_reload: bool = True,
namespace_key: str = "",
cache_size: int = 300
) -> BaseLoader

A CachingChoiceLoader is returned if cache_size > 0, otherwise a ChoiceLoader is returned. auto_reload and namespace_key are ignored if cache_key is less than 1.


  • loaders: List[BaseLoader] - A list of template loaders implementing liquid.loaders.BaseLoader.

  • auto_reload: bool = True - If True, automatically reload a cached template if it has been updated.

  • namespace_key: str = "" - The name of a global render context variable or loader keyword argument that resolves to the current loader "namespace" or "scope".

  • cache_size: int: 300 - The maximum number of templates to hold in the cache before removing the least recently used template.