vendredi 24 juillet 2015

Java: caching collections

Lets support we develop application in java and have a big table. And in order to increase performance we want to cache data. And here we have two ways of caching:

  1. object cache - by id.
  2. collection cache - caching collection of ids(!)

Example of collection cache. We have a sql query SELECT * FROM person WHERE birhddate=A AND age<B ORDER BY firstName,lastName. And for this query we cache collection of ids. Now, for the same query we can use cache. However, the problem of such caching is that if there is any updates/creates/deletes all collections caches become old and can't be used any more.

These are questions -

  1. is collection cache used in practice?
  2. are there any patterns/solutions/lib for java/algorithms to work with collection caches?

Aucun commentaire:

Enregistrer un commentaire