Created
August 13, 2015 08:17
-
-
Save whitekid/25dd5b6774ff6c786f14 to your computer and use it in GitHub Desktop.
oslo.cache
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
import oslo_cache.core as cache | |
from oslo_config import cfg | |
CONF = cfg.CONF | |
class CacheTest(unittest.TestCase): | |
def get_client(self): | |
cache.configure(CONF) | |
# setup cache option | |
CONF.set_override('enabled', True, 'cache') | |
CONF.set_override('backend', 'oslo_cache.memcache_pool', 'cache') | |
CONF.set_override('memcache_servers', ['your-memcache-server:11211'], 'cache') | |
region = cache.create_region() | |
cache.configure_cache_region(CONF, region) | |
return region | |
def test_cache(self): | |
client = self.get_client() | |
client.set('xxx', 'value') | |
self.assertEquals('value', client.get('xxx')) | |
if __name__ == '__main__': | |
unittest.main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment