public class ReferenceConfigCache extends Object
ReferenceConfig.
ReferenceConfig is a heavy Object, it's necessary to cache these object
for the framework which create ReferenceConfig frequently.
You can implement and use your own ReferenceConfig cache if you need use complicate strategy.
| Modifier and Type | Class and Description |
|---|---|
static interface |
ReferenceConfigCache.KeyGenerator |
| Modifier and Type | Field and Description |
|---|---|
static ReferenceConfigCache.KeyGenerator |
DEFAULT_KEY_GENERATOR
Create the key with the Group, Interface and version attribute of
ReferenceConfig. |
static String |
DEFAULT_NAME |
| Modifier and Type | Method and Description |
|---|---|
<T> void |
destroy(ReferenceConfig<T> referenceConfig)
clear and destroy one
ReferenceConfig in the cache. |
void |
destroyAll()
clear and destroy all
ReferenceConfig in the cache. |
<T> T |
get(ReferenceConfig<T> referenceConfig) |
static ReferenceConfigCache |
getCache()
Get the cache use default name and
DEFAULT_KEY_GENERATOR to generate cache key. |
static ReferenceConfigCache |
getCache(String name)
Get the cache use specified name and
ReferenceConfigCache.KeyGenerator. |
static ReferenceConfigCache |
getCache(String name,
ReferenceConfigCache.KeyGenerator keyGenerator)
Get the cache use specified
ReferenceConfigCache.KeyGenerator. |
String |
toString() |
public static final String DEFAULT_NAME
public static final ReferenceConfigCache.KeyGenerator DEFAULT_KEY_GENERATOR
ReferenceConfig.
key example: group1/com.alibaba.foo.FooService:1.0.0.
public static ReferenceConfigCache getCache()
DEFAULT_KEY_GENERATOR to generate cache key.
Create cache if not existed yet.public static ReferenceConfigCache getCache(String name)
ReferenceConfigCache.KeyGenerator.
Create cache if not existed yet.public static ReferenceConfigCache getCache(String name, ReferenceConfigCache.KeyGenerator keyGenerator)
ReferenceConfigCache.KeyGenerator.
Create cache if not existed yet.public <T> T get(ReferenceConfig<T> referenceConfig)
public <T> void destroy(ReferenceConfig<T> referenceConfig)
ReferenceConfig in the cache.referenceConfig - use for create key.public void destroyAll()
ReferenceConfig in the cache.Copyright © 2011–2018 The Apache Software Foundation. All rights reserved.