MrLiuFang commented on issue #12836:
URL: https://github.com/apache/dubbo/issues/12836#issuecomment-1670927793
> Dubbo -> proxy -> cache
**使用这种方式是可以的
把@Cacheable 放到@DubboService但是就失去了缓存的意义了, 需要走一次RPC调用, 这个过程比较耗时。
想把cache放在interface, 消费端引用interface, 直接在消费端走缓存减少RPC的调用耗时**
```
@DubboService(interfaceClass = FileExposeService.class)
public class FileExposeServiceImpl implements FileExposeService {
@Override
@Cacheable(value = FileDefinition.CACHE_KEY_URL_MULTIPLE,key = "#tableId
+ '-' + #fileFieldName + '-' +#tableName")
public Map<Long, String> getUrl(Long tableId, String
fileFieldName,String tableName) {
…………
return urls;
}
@Override
@Cacheable(value = FileDefinition.CACHE_KEY_URL_MULTIPLE,key = "#tableId
+ '-' + #fileFieldName + '-' +#tableName")
public String getUrlSingle(Long tableId, String fileFieldName, String
tableName) {
…………
return "";
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]