Пример #1
0
def configure_cache(region=None):
    if region is None:
        region = CACHE_REGION
    # NOTE(morganfainberg): running cache.configure_cache_region()
    # sets region.is_configured, this must be captured before
    # cache.configure_cache_region is called.
    configured = region.is_configured
    cache.configure_cache_region(CONF, region)
    # Only wrap the region if it was not configured. This should be pushed
    # to oslo_cache lib somehow.
    if not configured:
        region.wrap(_context_cache._ResponseCacheProxy)

        region_manager = RegionInvalidationManager(CACHE_INVALIDATION_REGION, region.name)
        region.key_mangler = key_mangler_factory(region_manager, region.key_mangler)
        region.region_invalidator = DistributedInvalidationStrategy(region_manager)
Пример #2
0
def configure_cache(region=None):
    if region is None:
        region = CACHE_REGION
    # NOTE(morganfainberg): running cache.configure_cache_region()
    # sets region.is_configured, this must be captured before
    # cache.configure_cache_region is called.
    configured = region.is_configured
    cache.configure_cache_region(CONF, region)
    # Only wrap the region if it was not configured. This should be pushed
    # to oslo_cache lib somehow.
    if not configured:
        region.wrap(_context_cache._ResponseCacheProxy)

        region_manager = RegionInvalidationManager(CACHE_INVALIDATION_REGION,
                                                   region.name)
        region.key_mangler = key_mangler_factory(region_manager,
                                                 region.key_mangler)
        region.region_invalidator = DistributedInvalidationStrategy(
            region_manager)