<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=mschipperheyn" rel="nofollow">marc schipperheyn</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-9538?redirect=false" rel="nofollow">SPR-9538</a></strong> and commented</p>
<p dir="auto">When you Cache a Collection of elements, you are caching the entire collection as an entry.</p>
<p dir="auto">The underlying elements can also be part of other <code class="notranslate">@Cacheable</code> entries, leading to duplicates and unnecessary memory consumption. Let's take the scenario of a Facebook Wall where a WallPost can be shared across hundreds of Walls with each Wall being a different collection of elements. Caching each collection would quickly become impossible or inefficient with high memory use and high numbers of cache refreshes.</p>
<p dir="auto">If the item to be cached is a collection, it could be considered to cache each individual element separately and cache the collection as a collection of references to the individual entries.</p>
<p dir="auto">EhCache supports this with the putAll method.</p>
<p dir="auto">Ideally you should be able to configure this so that the following <code class="notranslate">@Cacheable</code> methods</p>
<p dir="auto">mgr.getItem(Long id);<br>
mgr.getItems();<br>
mgr.getItems(Long userId);</p>
<p dir="auto">all take their items from the same pool.</p>
<p dir="auto">When a collection requests items that are not available in the pool, even more ideally, a dao request would be made for the missing items.</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 3.1.1</p>
<p dir="auto"><strong>Issue Links:</strong></p>
<ul dir="auto">
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398176695" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/17326" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/17326/hovercard" href="https://github.com/spring-projects/spring-framework/issues/17326">#17326</a> Caching strategy (<em><strong>"duplicates"</strong></em>)</li>
</ul>
<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=anthavio" rel="nofollow">Martin Vanek</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-9000?redirect=false" rel="nofollow">SPR-9000</a></strong> and commented</p>
<p dir="auto">In xml configuration I often use bean with parent="true" to set default values in parent context and multiple nonabstract beans in several child contexts with mandatory but always different dependency.<br>
Because abstract bean concept is missing in <code class="notranslate">@Bean</code> code configuration this leads to lots of duplication</p>
<p dir="auto">For example I have abstract LocalContainerEntityManagerFactoryBean bean in parent "platform" context preconfigured with jpaVendorAdapter and jpaPropertyMap, but dataSource is specified in child "dbmodel" context</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 3.1 GA</p>