Skip to content
Permalink
Browse files
Switching to new ehcache version
  • Loading branch information
effrafax committed Jan 3, 2022
1 parent a45ba04 commit 5d6714658343d31860e54195cd8b872c418f4bb4
Showing 12 changed files with 334 additions and 188 deletions.
@@ -27,8 +27,9 @@
* CacheCreator - an interface for CacheCreators
*
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
* @author Martin Schreier <martin_s@apache.org>
*/
public interface CacheCreator
public interface CacheCreator<K,V>
{
/**
* Create a Cache, initialize it, and return it.
@@ -37,5 +38,5 @@
* @return the created cache.
* @throws CacheException if there was a cache creation error.
*/
public Cache createCache( CacheHints hints ) throws CacheException;
public Cache<K,V> createCache( CacheHints hints, Class<K> keyType, Class<V> valueType ) throws CacheException;
}
@@ -114,7 +114,7 @@ public void setCacheCreatorFactory( CacheCreator creator )
CacheFactory.creator = creator;
}

public Cache getCache( String id, CacheHints hints )
public <K,V> Cache<K,V> getCache( String id, Class<K> keyType, Class<V> valueType, CacheHints hints )
throws CacheException
{
if ( creator == null )
@@ -124,7 +124,7 @@ public Cache getCache( String id, CacheHints hints )

if ( caches.containsKey( id ) )
{
return (Cache) caches.get( id );
return (Cache<K,V>) caches.get( id );
}

if ( hints == null )
@@ -134,9 +134,9 @@ public Cache getCache( String id, CacheHints hints )
hints.setName( id );
}

Cache cache = CacheFactory.creator.createCache( hints );
Cache<K,V> cache = CacheFactory.creator.createCache( hints, keyType, valueType );

caches.put( id, cache );
return (Cache) cache;
return cache;
}
}
@@ -40,9 +40,9 @@

<dependencies>
<dependency>
<groupId>net.sf.ehcache</groupId>
<groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>2.10.9.2</version>
<version>3.9.9</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>

0 comments on commit 5d67146

Please sign in to comment.