Spring Cache Abstraction with multi-value queries

后端 未结 3 1080
我寻月下人不归
我寻月下人不归 2021-01-21 12:44

Does Spring Cache abstraction support multi-value queries?

Instead of:

@Cacheable(\"books\") public Book findBook(ISBN isbn) {...}

Imagine a query that g

3条回答
  •  清酒与你
    2021-01-21 13:24

    Spring Cache stores whole result under single cache key, so it is not possible to store individually each object returned in the collection. In case of caching result of a JPA Query you may use query cache. In other cases if memcached is an option for you, you can try Simple Spring Memcached and ReadThroughMultiCache annotation. It will store each element of the collection individually under dedicated cache key.

提交回复
热议问题