I use Spring, Postgres, JPA and MVC pattern. I'm thinking, if you cache a collection of objects 100-200 (7-10 fields), at the repository level and then mess around with it at the service level, perform a filtering search and everything else. Or is it better to go to the database to receive a new bundle of objects, depending on the search parameters, and let it give you what you need?

    1 answer 1

    The usual rule in such cases is not to do pre-optimization. I would advise not to bother with the creation of the cache, if it turns out that it works slowly then think how to optimize. If you are using hibernate, you can first configure the second level cache.