diff --git a/ehcache-jcache/pom.xml b/ehcache-jcache/pom.xml
index cfcce58..985f1cb 100755
--- a/ehcache-jcache/pom.xml
+++ b/ehcache-jcache/pom.xml
@@ -83,6 +83,9 @@
org.apache.maven.plugins
maven-javadoc-plugin
2.8
+
+ -Xdoclint:none
+
attach-javadocs
diff --git a/ehcache-jcache/src/main/java/org/ehcache/jcache/JCacheConfiguration.java b/ehcache-jcache/src/main/java/org/ehcache/jcache/JCacheConfiguration.java
index 61928ae..535f151 100644
--- a/ehcache-jcache/src/main/java/org/ehcache/jcache/JCacheConfiguration.java
+++ b/ehcache-jcache/src/main/java/org/ehcache/jcache/JCacheConfiguration.java
@@ -98,17 +98,35 @@ public JCacheConfiguration(final CacheConfiguration cacheConfiguration, final Co
expiryPolicy = new ExpiryPolicy() {
@Override
public Duration getExpiryForCreation() {
- return new Duration(TimeUnit.SECONDS, cacheConfiguration.getTimeToLiveSeconds());
+ if (cacheConfiguration.getTimeToLiveSeconds() > 0) {
+ return new Duration(TimeUnit.SECONDS, cacheConfiguration.getTimeToLiveSeconds());
+ } else if (cacheConfiguration.getTimeToIdleSeconds() > 0) {
+ return new Duration(TimeUnit.SECONDS, cacheConfiguration.getTimeToIdleSeconds());
+ } else {
+ return Duration.ETERNAL;
+ }
}
@Override
public Duration getExpiryForAccess() {
- return new Duration(TimeUnit.SECONDS, cacheConfiguration.getTimeToLiveSeconds());
+ if (cacheConfiguration.getTimeToLiveSeconds() > 0) {
+ return null;
+ } else if (cacheConfiguration.getTimeToIdleSeconds() > 0) {
+ return new Duration(TimeUnit.SECONDS, cacheConfiguration.getTimeToIdleSeconds());
+ } else {
+ return null;
+ }
}
@Override
public Duration getExpiryForUpdate() {
- return getExpiryForCreation();
+ if (cacheConfiguration.getTimeToLiveSeconds() > 0) {
+ return new Duration(TimeUnit.SECONDS, cacheConfiguration.getTimeToLiveSeconds());
+ } else if (cacheConfiguration.getTimeToIdleSeconds() > 0) {
+ return new Duration(TimeUnit.SECONDS, cacheConfiguration.getTimeToIdleSeconds());
+ } else {
+ return null;
+ }
}
};
}
diff --git a/ehcache-jcache/src/main/java/org/ehcache/jcache/JCacheManager.java b/ehcache-jcache/src/main/java/org/ehcache/jcache/JCacheManager.java
index 5792955..54be461 100644
--- a/ehcache-jcache/src/main/java/org/ehcache/jcache/JCacheManager.java
+++ b/ehcache-jcache/src/main/java/org/ehcache/jcache/JCacheManager.java
@@ -71,7 +71,7 @@ public JCacheManager(final JCacheCachingProvider jCacheCachingProvider, final Ca
this.cacheManager = cacheManager;
this.uri = uri;
this.props = props;
- refreshAllCaches();
+ //refreshAllCaches();
}
@Override
@@ -143,7 +143,7 @@ public Cache getCache(final String cacheName, final Class keyTyp
if (cache == null) {
return null;
}
- jCache = new JCache(this, new JCacheConfiguration(null, null, keyType, valueType), cache);
+ jCache = new JCache(this, new JCacheConfiguration(cache.getCacheConfiguration(), null, keyType, valueType), cache);
final JCache previous = allCaches.putIfAbsent(cacheName, jCache);
if(previous != null) {
jCache = previous;
@@ -161,7 +161,11 @@ public Cache getCache(final String cacheName, final Class keyTyp
public Cache getCache(final String cacheName) {
final JCache jCache = allCaches.get(cacheName);
if(jCache == null) {
- refreshAllCaches();
+ //refreshAllCaches();
+ final net.sf.ehcache.Cache cache = cacheManager.getCache(cacheName);
+ if (cache != null) {
+ allCaches.put(cacheName, new JCache(this, new JCacheConfiguration(cache.getCacheConfiguration()), cache));
+ }
return allCaches.get(cacheName);
}
if(jCache.getConfiguration(CompleteConfiguration.class).getKeyType() != Object.class ||