<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>
	Comments on: Spring + Ehcache: XML-less Spring Configuration for Ehcache 2.x vs Ehcache 3.x	</title>
	<atom:link href="https://myshittycode.com/2017/04/11/spring-ehcache-xml-less-spring-configuration-for-ehcache-2-x-vs-ehcache-3-x/feed/" rel="self" type="application/rss+xml" />
	<link>https://myshittycode.com/2017/04/11/spring-ehcache-xml-less-spring-configuration-for-ehcache-2-x-vs-ehcache-3-x/</link>
	<description>Embracing the Messiness in Search of Epic Solutions</description>
	<lastBuildDate>Fri, 06 Jan 2023 16:28:00 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0</generator>
	<item>
		<title>
		By: idosama		</title>
		<link>https://myshittycode.com/2017/04/11/spring-ehcache-xml-less-spring-configuration-for-ehcache-2-x-vs-ehcache-3-x/#comment-93</link>

		<dc:creator><![CDATA[idosama]]></dc:creator>
		<pubDate>Mon, 30 Apr 2018 12:56:39 +0000</pubDate>
		<guid isPermaLink="false">http://myshittycode.com/?p=958#comment-93</guid>

					<description><![CDATA[Hi. Thanks for the code, i was looking the EhCache3 with JSR-107 everywhere, but the code have errors. Here&#039;s the fix:

import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.jcache.JCacheCacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.cache.CacheManager;
import javax.cache.Caching;
import javax.cache.configuration.MutableConfiguration;
import javax.cache.expiry.CreatedExpiryPolicy;
import javax.cache.expiry.Duration;
import javax.cache.spi.CachingProvider;
import java.util.concurrent.TimeUnit;

@Configuration
@EnableCaching
public class Config {

    @Bean
    JCacheCacheManager jCacheCacheManager() {
        return new JCacheCacheManager(cacheManager());
    }

    @Bean(destroyMethod = &quot;close&quot;)
    CacheManager cacheManager() {
        CachingProvider provider = Caching.getCachingProvider();
        CacheManager cacheManager = provider.getCacheManager();

        MutableConfiguration cacheConfiguration = new MutableConfiguration()
                .setTypes(Object.class, Object.class)
                .setStoreByValue(false)
                .setExpiryPolicyFactory(CreatedExpiryPolicy.factoryOf(new Duration(TimeUnit.SECONDS, 30)));

        cacheManager.createCache(&quot;myCache&quot;, cacheConfiguration);

        return cacheManager;
    }
}]]></description>
			<content:encoded><![CDATA[<p>Hi. Thanks for the code, i was looking the EhCache3 with JSR-107 everywhere, but the code have errors. Here&#8217;s the fix:</p>
<p>import org.springframework.cache.annotation.EnableCaching;<br />
import org.springframework.cache.jcache.JCacheCacheManager;<br />
import org.springframework.context.annotation.Bean;<br />
import org.springframework.context.annotation.Configuration;</p>
<p>import javax.cache.CacheManager;<br />
import javax.cache.Caching;<br />
import javax.cache.configuration.MutableConfiguration;<br />
import javax.cache.expiry.CreatedExpiryPolicy;<br />
import javax.cache.expiry.Duration;<br />
import javax.cache.spi.CachingProvider;<br />
import java.util.concurrent.TimeUnit;</p>
<p>@Configuration<br />
@EnableCaching<br />
public class Config {</p>
<p>    @Bean<br />
    JCacheCacheManager jCacheCacheManager() {<br />
        return new JCacheCacheManager(cacheManager());<br />
    }</p>
<p>    @Bean(destroyMethod = &#8220;close&#8221;)<br />
    CacheManager cacheManager() {<br />
        CachingProvider provider = Caching.getCachingProvider();<br />
        CacheManager cacheManager = provider.getCacheManager();</p>
<p>        MutableConfiguration cacheConfiguration = new MutableConfiguration()<br />
                .setTypes(Object.class, Object.class)<br />
                .setStoreByValue(false)<br />
                .setExpiryPolicyFactory(CreatedExpiryPolicy.factoryOf(new Duration(TimeUnit.SECONDS, 30)));</p>
<p>        cacheManager.createCache(&#8220;myCache&#8221;, cacheConfiguration);</p>
<p>        return cacheManager;<br />
    }<br />
}</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

Page Caching using Disk: Enhanced 
Lazy Loading (feed)
Database Caching 54/64 queries in 0.058 seconds using Disk

Served from: myshittycode.com @ 2026-07-04 14:19:54 by W3 Total Cache
-->