Using Guava for high performance thread-safe caching

前端 未结 2 511
遥遥无期
遥遥无期 2021-02-18 17:59

I am trying to implement a high performance thread-safe caching. Here is the code I have implemented. I don\'t want any on demand computing. Can I use cache.asMap() and retrieve

2条回答
  •  执笔经年
    2021-02-18 18:19

    Guava contributor here:

    Yes, that looks just fine, although I'm not sure what the point is of wrapping the cache in another object. (Also, Cache.getIfPresent(key) is fully equivalent to Cache.asMap().get(key).)

提交回复
热议问题