I have a
LoadingCache<Long, String> idNameMap
that needs to be populated. The ids are unique in the context of my application. However, due to the way data is stored in the table, I need to pass in extra parameters to database query to complete a fast database lookup. Which means that I should be able to pass these parameters to my loadAll method which currently looks like:
@Override
public Map<Long, String> loadAll(Iterable idsIterable) throws Exception {
//pass in ids and extra parameters to improve database query speed
}
Those extra parameters do not need to be part of my cache. My question is that what pattern should I use to solve this problem?
Aucun commentaire:
Enregistrer un commentaire