Merge "Change dogpile cache defaults"

This commit is contained in:
Jenkins 2015-03-13 18:31:11 +00:00 committed by Gerrit Code Review
commit 42c52589a6
2 changed files with 15 additions and 5 deletions
README.rst
os_client_config

@ -112,13 +112,21 @@ Cache Settings
Accessing a cloud is often expensive, so it's quite common to want to do some
client-side caching of those operations. To facilitate that, os-client-config
understands a simple set of cache control settings.
understands passing through cache settings to dogpile.cache, with the following
behaviors:
* Listing no config settings means you get a null cache.
* `cache.max_age` and nothing else gets you memory cache.
* Otherwise, `cache.class` and `cache.arguments` are passed in
::
cache:
path: ~/.cache/openstack
max_age: 300
class: dogpile.cache.pylibmc
max_age: 3600
arguments:
url:
- 127.0.0.1
clouds:
mordred:
cloud: hp

@ -88,13 +88,15 @@ class OpenStackConfig(object):
self.cloud_config = dict(
clouds=dict(openstack=dict(self.defaults)))
self._cache_max_age = 300
self._cache_max_age = None
self._cache_path = CACHE_PATH
self._cache_class = 'dogpile.cache.memory'
self._cache_class = 'dogpile.cache.null'
self._cache_arguments = {}
if 'cache' in self.cloud_config:
self._cache_max_age = self.cloud_config['cache'].get(
'max_age', self._cache_max_age)
if self._cache_max_age:
self._cache_class = 'dogpile.cache.memory'
self._cache_path = os.path.expanduser(
self.cloud_config['cache'].get('path', self._cache_path))
self._cache_class = self.cloud_config['cache'].get(