Skip to content

Commit

Permalink
Allow setting of the cache implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
digitalresistor committed Jan 2, 2023
1 parent 195a0b7 commit 80c5bfa
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 13 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ to the location of the ``my.package`` Python package.
+-----------------------------+

Mako Caching
----------------
------------

The values supplied here are passed in ``TemplateLookup`` as the ``cache_args``.
`More docs about caching in Mako
Expand All @@ -372,6 +372,18 @@ The values supplied here are passed in ``TemplateLookup`` as the ``cache_args``.
| ``mako.cache.dir`` |
+-----------------------------+

Setting the cache implementation is done using the `cache_impl`, the Mako
default is to use ``beaker``.

+-----------------------------+
| Config File Setting Name |
+=============================+
| ``mako.cache_impl`` |
| |
| |
| |
+-----------------------------+

Mako Module Directory
---------------------

Expand Down
2 changes: 2 additions & 0 deletions src/pyramid_mako/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ def sget(name, default=None):
strict_undefined = asbool(sget("strict_undefined", False))
preprocessor = sget("preprocessor", None)
preprocessor_wants_settings = asbool(sget("preprocessor_wants_settings", None))
cache_impl = sget("cache_impl", "beaker")
cache_type = sget("cache.type", None)
cache_dir = sget("cache.dir", module_directory)
cache_timeout = sget("cache.timeout", None)
Expand Down Expand Up @@ -242,6 +243,7 @@ def preprocessor_injector(template):
filesystem_checks=reload_templates,
strict_undefined=strict_undefined,
preprocessor=preprocessor,
cache_impl=cache_impl,
cache_args=dict(
timeout=cache_timeout,
url=cache_url,
Expand Down

0 comments on commit 80c5bfa

Please sign in to comment.