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:
- object cache - by id.
- 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 -
- is collection cache used in practice?
- are there any patterns/solutions/lib for java/algorithms to work with collection caches?
Aucun commentaire:
Enregistrer un commentaire