Pre-load values for a Guava Cache

后端 未结 2 659
予麋鹿
予麋鹿 2021-02-07 00:54

I have a requirement where we are loading static data from a database for use in a Java application. Any caching mechanism should have the following functionality:

2条回答
  •  日久生厌
    2021-02-07 01:11

    In the short-term I would just use Cache.asMap().putAll(Map).

    Once Guava 11.0 is released you can use Cache.getAll(Iterable), which will issue a single bulk request for all absent elements.

提交回复
热议问题