@Activate(group={"consumer","provider"}, value="cache") public class CacheFilter extends Object implements Filter
e.g. 1)<dubbo:service cache="lru" />
2)<dubbo:service /> <dubbo:method name="method2" cache="threadlocal" /> <dubbo:service/>
3)<dubbo:provider cache="expiring" />
4)<dubbo:consumer cache="jcache" />
If cache type is defined in method level then method level type will get precedence. According to above provided
example, if service has two method, method1 and method2, method2 will have cache type as threadlocal where others will
be backed by lru
Filter.Listener| 构造器和说明 |
|---|
CacheFilter() |
| 限定符和类型 | 方法和说明 |
|---|---|
Result |
invoke(Invoker<?> invoker,
Invocation invocation)
If cache is configured, dubbo will invoke method on each method call.
|
void |
setCacheFactory(CacheFactory cacheFactory)
Dubbo will populate and set the cache factory instance based on service/method/consumer/provider configured
cache attribute value.
|
onResponsepublic void setCacheFactory(CacheFactory cacheFactory)
cacheFactory - instance of CacheFactory based on cache typepublic Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException
invoke 在接口中 Filterinvoker - serviceinvocation - invocation.RpcExceptionCopyright © 2011–2019 The Apache Software Foundation. All rights reserved.