protected Cache createCache ( ) throws IOException { // this factory creates only one single cache and return it if someone invoked this method twice or // more if ( cache != null ) { throw new IllegalStateException ( String . format ( "This factory has already created memcached client for cache %s" , cacheName ) ) ; } if ( isCacheDisabled ( ) ) { LOGGER . warn ( "Cache {} is disabled" , cacheName ) ; cache = ( Cache ) Proxy . newProxyInstance ( Cache . class . getClassLoader ( ) , new Class [ ] { Cache . class } , new DisabledCacheInvocationHandler ( cacheName , cacheAliases ) ) ; return cache ; } if ( configuration == null ) { throw new RuntimeException ( String . format ( "The MemcachedConnectionBean for cache %s must be defined!" , cacheName ) ) ; } List < InetSocketAddress > addrs = addressProvider . getAddresses ( ) ; cache = new CacheImpl ( cacheName , cacheAliases , createClient ( addrs ) , defaultSerializationType , jsonTranscoder , javaTranscoder , customTranscoder , new CacheProperties ( configuration . isUseNameAsKeyPrefix ( ) , configuration . getKeyPrefixSeparator ( ) ) ) ; return cache ; }
Only one cache is created .