def test_cache_manager_repr(): settings = {'a': {}, 'b': {}, 'c': {}} cacheman = CacheManager() assert repr(cacheman) == 'CacheManager([])' cacheman.setup(settings) assert repr(cacheman) == "CacheManager(['a', 'b', 'c'])"
def test_cache_manager_repr(): settings = {"a": {}, "b": {}, "c": {}} cacheman = CacheManager() assert repr(cacheman) == "CacheManager([])" cacheman.setup(settings) assert repr(cacheman) == "CacheManager(['a', 'b', 'c'])"
def test_cache_manager_setup(): """Test that CacheManager.setup() initializes caches.""" settings = {str(n): {} for n in range(5)} cacheman = CacheManager(settings) caches = {name: cache for name, cache in cacheman} for name in settings.keys(): assert name in cacheman # Empty settings will delete cache instances. cacheman.setup() for name in settings.keys(): assert name not in cacheman # Setup again to create all new cache instances. cacheman.setup(settings) for name, options in settings.items(): cache = cacheman[name] assert_cache_options(cache, options) assert cache is not caches[name]
cache_set.setup({ 'TOPIC_BY_ID': { 'cache_class': TopicByIdCache, 'maxsize': 512 }, 'TOPIC_BY_TENANT_AND_NAME': { 'cache_class': TopicByTenantAndNameCache, 'maxsize': 512 }, 'TOPIC_SCHEMA_BY_ID': { 'cache_class': TopicSchemaByIdCache, 'maxsize': 512 }, 'TOPIC_ENTITY_HELPER_BY_ID': { 'cache_class': TopicEntityHelperByIdCache, 'maxsize': 512 }, 'PIPELINE_BY_ID': { 'cache_class': PipelineByIdCache, 'maxsize': 1024 }, 'PIPELINE_BY_TOPIC_ID': { 'cache_class': PipelineByTopicIdCache, 'maxsize': 512 }, 'DATA_SOURCE_BY_ID': { 'cache_class': DataSourceByIdCache, 'maxsize': 64 }, 'DATA_STORAGE_BUILDER_BY_ID': { 'cache_class': DataStorageBuilderByIdCache, 'maxsize': 64 }, 'EXTERNAL_WRITER_BY_ID': { 'cache_class': ExternalWriterByIdCache, 'maxsize': 16 }, 'TENANT_BY_ID': { 'cache_class': TenantByIdCache, 'maxsize': 32 }, 'KEY_STORE_BY_TYPE': { 'cache_class': KeyStoreByTypeCache, 'maxsize': 32 } })