[英]guava's cacheloader load method with more args?
When the CacheLoader loads something for my Key, I need to pass in some initialization information(basically, a property of what is created). 当CacheLoader为我的Key加载某些内容时,我需要传递一些初始化信息(基本上是所创建内容的属性)。
Unfortunately, the load method only takes a Key K. I could overload the Key we use to have an extra field that is not used in the equals/hashcode but that seems a bit ugly. 不幸的是,load方法仅使用KeyK。我可以重载我们使用的Key来拥有一个等于/ hashcode中未使用的额外字段,但这看起来有点难看。 is there another option such that I can pass information for construction or an ability to pass in a callback creation with the property info in my callback already?
是否还有其他选择可以使我传递构造信息或通过回调函数传递带有属性信息的回调创建功能? basically, every time I read from cache, I would pass key and callback.
基本上,每次我从缓存读取时,我都会传递键和回调。
an ability to pass in a callback creation with the property info in my callback already?
能够在回调中传递带有属性信息的回调创建的功能?
Are you looking for Cache.get(K, Callable<? extends V>)
? 您是否正在寻找
Cache.get(K, Callable<? extends V>)
?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.