# HG changeset patch # User Thierry Florac # Date 1498564693 -7200 # Node ID 09517b76155b3c761d44f8f25968c57b6833dbf0 # Parent a9b43f8fe1679bda17626dbb58084092295f70c6 Added beaker's "get_cache" helper function diff -r a9b43f8fe167 -r 09517b76155b src/pyams_cache/beaker.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_cache/beaker.py Tue Jun 27 13:58:13 2017 +0200 @@ -0,0 +1,27 @@ +# +# Copyright (c) 2008-2015 Thierry Florac +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# + +__docformat__ = 'restructuredtext' + + +# import standard library + +# import interfaces + +# import packages +from beaker import cache + + +def get_cache(region, cache_name): + """Get Beaker cache matching given name""" + cache_manager = cache.CacheManager(**cache.cache_regions[region]) + return cache_manager.get_cache(cache_name)