You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by ke...@apache.org on 2026/08/17 17:03:06 UTC
(allura) branch kt/SF-11610 created (now 98f55abe8)
This is an automated email from the ASF dual-hosted git repository.
asf-gitbox-commits pushed a change to branch kt/SF-11610
in repository https://gitbox.apache.org/repos/asf/allura.git
at 98f55abe8 SF-11610 POC of memcached dependency replacement
This branch includes the following new commits:
new 98f55abe8 SF-11610 POC of memcached dependency replacement
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(allura) 01/01: SF-11610 POC of memcached dependency replacement
Posted by ke...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
asf-gitbox-commits pushed a commit to branch kt/SF-11610
in repository https://gitbox.apache.org/repos/asf/allura.git
commit 98f55abe8f6a27985451cd4f3470a48cb814aa91
Author: Kenton Taylor <kt...@slashdotmedia.com>
AuthorDate: Mon Aug 17 17:02:04 2026 +0000
SF-11610 POC of memcached dependency replacement
---
Allura/allura/config/app_cfg.py | 11 +++++------
Allura/allura/lib/custom_middleware.py | 7 -------
Allura/development.ini | 3 +--
3 files changed, 6 insertions(+), 15 deletions(-)
diff --git a/Allura/allura/config/app_cfg.py b/Allura/allura/config/app_cfg.py
index db663dbbf..55f9c4d32 100644
--- a/Allura/allura/config/app_cfg.py
+++ b/Allura/allura/config/app_cfg.py
@@ -155,15 +155,14 @@ def _setup_bytecode_cache(cls):
bcc = None
try:
if 'pytest' in sys.modules:
- # speedup for tests: avoid memcache, avoid loading/dumping bytecode to strings. Use same one for all tests
+ # speedup for tests: avoid mongo, avoid loading/dumping bytecode to strings. Use same one for all tests
bcc = long_term_in_memory_bytecode_cache
- elif cache_type == 'memcached' and config.get('memcached_host'):
- import pylibmc
- from jinja2 import MemcachedBytecodeCache
- client = pylibmc.Client([config['memcached_host']])
+ elif cache_type == 'mongodb':
+ from sftheme.jinja_bytecode_cache import MongoBytecodeCache
+ retain_days = int(config.get('jinja_bytecode_cache_retain_days', 7))
bcc_prefix = f'jinja2/{jinja2.__version__}/'
bcc_prefix += f'py{sys.version_info.major}{sys.version_info.minor}/'
- bcc = MemcachedBytecodeCache(client, prefix=bcc_prefix)
+ bcc = MongoBytecodeCache(bcc_prefix, ming_session_name='main', retain_days=retain_days)
elif cache_type == 'filesystem':
from jinja2 import FileSystemBytecodeCache
bcc = FileSystemBytecodeCache(pattern=f'__jinja2_{jinja2.__version__}_%s.cache')
diff --git a/Allura/allura/lib/custom_middleware.py b/Allura/allura/lib/custom_middleware.py
index 5767f4ea7..1812b97ff 100644
--- a/Allura/allura/lib/custom_middleware.py
+++ b/Allura/allura/lib/custom_middleware.py
@@ -367,13 +367,6 @@ def timers(self):
'bind_s', 'unbind_s', 'add_s', 'modify_s', 'search_s'),
]
- if self.config.get('memcached_host'):
- import pylibmc
- timers += [
- Timer('memcache.get', pylibmc.client.Client, 'get'),
- Timer('memcache.set', pylibmc.client.Client, 'set'),
- ]
-
return timers
def before_logging(self, stat_record):
diff --git a/Allura/development.ini b/Allura/development.ini
index a76316620..fc31ba17f 100644
--- a/Allura/development.ini
+++ b/Allura/development.ini
@@ -103,8 +103,7 @@ cache_dir = %(here)s/data
; See http://jinja.pocoo.org/docs/api/#jinja2.Environment
jinja_cache_size = -1
;jinja_bytecode_cache_type = filesystem
-;jinja_bytecode_cache_type = memcached
-;memcached_host =
+;jinja_bytecode_cache_type = mongodb
; Docs at http://beaker.readthedocs.org/en/latest/configuration.html#session-options
; and http://beaker.readthedocs.org/en/latest/modules/session.html#beaker.session.CookieSession