When the CacheLoader loads something for my Key, I need to pass in some initialization information(basically, a property of what is created).
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. 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>)
?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.