/** * Remove all keys from the specified cache. * <p> * @param cacheName * @throws IOException */ @Override public void removeAll( String cacheName ) throws IOException { removeAll( cacheName, 0 ); }
/** * Puts a cache item to the cache. * <p> * @param item * @throws IOException */ @Override public void update( ICacheElement<K, V> item ) throws IOException { update( item, 0 ); }
/** * Constructs a client. * <p> * @param attributes */ public RemoteHttpCacheClient( RemoteHttpCacheAttributes attributes ) { setRemoteHttpCacheAttributes( attributes ); initialize( attributes ); }
/** Verify that we get the default. */ public void testCreateRemoteHttpCacheClient_Bad() { // SETUP String remoteHttpClientClassName = "junk"; RemoteHttpCacheAttributes cattr = new RemoteHttpCacheAttributes(); cattr.setRemoteHttpClientClassName( remoteHttpClientClassName ); RemoteHttpCacheFactory factory = new RemoteHttpCacheFactory(); // DO WORK IRemoteHttpCacheClient<String, String> result = factory.createRemoteHttpCacheClientForAttributes( cattr ); // VEIFY assertNotNull( "Should have a cache.", result ); assertTrue( "Wrong default.", result instanceof RemoteHttpCacheClient ); assertTrue( "Should be initialized", ((RemoteHttpCacheClient<String, String>)result).isInitialized() ); }
/** * The provides an extension point. If you want to extend this and use a special dispatcher, * here is the place to do it. * <p> * @param attributes */ @Override public void initialize( RemoteHttpCacheAttributes attributes ) { setRemoteDispatcher( new RemoteHttpCacheDispatcher( attributes ) ); if ( log.isInfoEnabled() ) { log.info( "Created remote Dispatcher." + getRemoteDispatcher() ); } setInitialized( true ); }
/** Verify that we get the default. */ public void testCreateRemoteHttpCacheClient_default() { // SETUP RemoteHttpCacheAttributes cattr = new RemoteHttpCacheAttributes(); RemoteHttpCacheFactory factory = new RemoteHttpCacheFactory(); // DO WORK IRemoteHttpCacheClient<String, String> result = factory.createRemoteHttpCacheClientForAttributes( cattr ); // VEIFY assertNotNull( "Should have a cache.", result ); assertTrue( "Wrong default.", result instanceof RemoteHttpCacheClient ); }
/** * Returns a remote cache for the given cache name. * <p> * @param cacheName * @return The cache value */ // @Override public <K, V> RemoteCacheNoWait<K, V> getCache( String cacheName ) { // TODO get some defaults! // Perhaps we will need a manager per URL???? RemoteHttpCacheAttributes ca = new RemoteHttpCacheAttributes(); ca.setCacheName( cacheName ); return getCache( ca ); }
/** Verify that we get a cache no wait. */ public void testGetCache_normal() { // SETUP ICompositeCacheManager cacheMgr = new MockCompositeCacheManager(); ICacheEventLogger cacheEventLogger = null; IElementSerializer elementSerializer = null; RemoteHttpCacheAttributes cattr = new RemoteHttpCacheAttributes(); RemoteHttpCacheFactory factory = new RemoteHttpCacheFactory(); // DO WORK AuxiliaryCache<String, String> result = factory.createCache(cattr, cacheMgr, cacheEventLogger, elementSerializer); // VEIFY assertNotNull( "Should have a cache.", result ); } }
/** * Removes the given key from the specified cache. * <p> * @param cacheName * @param key * @throws IOException */ @Override public void remove( String cacheName, K key ) throws IOException { remove( cacheName, key, 0 ); }
/** * Create a request, process, extract the payload. * <p> * @param cacheName * @param key * @return ICacheElement * @throws IOException */ @Override public ICacheElement<K, V> get( String cacheName, K key ) throws IOException { return get( cacheName, key, 0 ); }
/** * Gets multiple items from the cache based on the given set of keys. * <p> * @param cacheName * @param keys * @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no * data in cache for any of these keys * @throws IOException */ @Override public Map<K, ICacheElement<K, V>> getMultiple( String cacheName, Set<K> keys ) throws IOException { return getMultiple( cacheName, keys, 0 ); }
/** * Gets multiple items from the cache matching the pattern. * <p> * @param cacheName * @param pattern * @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no * data in cache matching the pattern. * @throws IOException */ @Override public Map<K, ICacheElement<K, V>> getMatching( String cacheName, String pattern ) throws IOException { return getMatching( cacheName, pattern, 0 ); }
/** * Constructor for the RemoteCache object. This object communicates with a remote cache server. * One of these exists for each region. This also holds a reference to a listener. The same * listener is used for all regions for one remote server. Holding a reference to the listener * allows this object to know the listener id assigned by the remote cache. * <p> * @param remoteHttpCacheAttributes * @param remote * @param listener */ public RemoteHttpCache( RemoteHttpCacheAttributes remoteHttpCacheAttributes, ICacheServiceNonLocal<K, V> remote, IRemoteCacheListener<K, V> listener ) { super( remoteHttpCacheAttributes, remote, listener ); setRemoteHttpCacheAttributes( remoteHttpCacheAttributes ); }
/** * Remove all keys from the specified cache. * <p> * @param cacheName * @throws IOException */ @Override public void removeAll( String cacheName ) throws IOException { removeAll( cacheName, 0 ); }
/** * Puts a cache item to the cache. * <p> * @param item * @throws IOException */ @Override public void update( ICacheElement<K, V> item ) throws IOException { update( item, 0 ); }
/** * Constructs a client. * <p> * @param attributes */ public RemoteHttpCacheClient( RemoteHttpCacheAttributes attributes ) { setRemoteHttpCacheAttributes( attributes ); initialize( attributes ); }
/** * Removes the given key from the specified cache. * <p> * @param cacheName * @param key * @throws IOException */ @Override public void remove( String cacheName, K key ) throws IOException { remove( cacheName, key, 0 ); }
/** * Create a request, process, extract the payload. * <p> * @param cacheName * @param key * @return ICacheElement * @throws IOException */ @Override public ICacheElement<K, V> get( String cacheName, K key ) throws IOException { return get( cacheName, key, 0 ); }
/** * Gets multiple items from the cache based on the given set of keys. * <p> * @param cacheName * @param keys * @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no * data in cache for any of these keys * @throws IOException */ @Override public Map<K, ICacheElement<K, V>> getMultiple( String cacheName, Set<K> keys ) throws IOException { return getMultiple( cacheName, keys, 0 ); }
/** * Gets multiple items from the cache matching the pattern. * <p> * @param cacheName * @param pattern * @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no * data in cache matching the pattern. * @throws IOException */ @Override public Map<K, ICacheElement<K, V>> getMatching( String cacheName, String pattern ) throws IOException { return getMatching( cacheName, pattern, 0 ); }