summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-03-13 18:31:11 +0000
committerGerrit Code Review <review@openstack.org>2015-03-13 18:31:11 +0000
commit42c52589a67e761d59b54ea432299c7192a2828c (patch)
treeb9638a6385de911d035386a86306e04e38b97789
parente5d2782cef302dbc677ebba06f5f7f3e520b1031 (diff)
parent63e1630f2b44e1f867ed887ea7d66b76daca671a (diff)
downloados-client-config-42c52589a67e761d59b54ea432299c7192a2828c.tar.gz
Merge "Change dogpile cache defaults"
-rw-r--r--README.rst14
-rw-r--r--os_client_config/config.py6
2 files changed, 15 insertions, 5 deletions
diff --git a/README.rst b/README.rst
index e6dbed0..4c67acf 100644
--- a/README.rst
+++ b/README.rst
@@ -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
diff --git a/os_client_config/config.py b/os_client_config/config.py
index 48b99f5..8494043 100644
--- a/os_client_config/config.py
+++ b/os_client_config/config.py
@@ -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(