Class RemoteHttpCacheClient<K,V>
java.lang.Object
org.apache.commons.jcs3.auxiliary.remote.http.client.RemoteHttpCacheClient<K,V>
- All Implemented Interfaces:
Remote,IRemoteHttpCacheClient<K,,V> ICacheService<K,,V> ICacheServiceNonLocal<K,V>
This is the service used by the remote http auxiliary cache.
-
Constructor Summary
ConstructorsConstructorDescriptionFor factory construction.RemoteHttpCacheClient(RemoteHttpCacheAttributes attributes) Constructs a client. -
Method Summary
Modifier and TypeMethodDescriptionvoidFrees the specified cache.Create a request, process, extract the payload.Create a request, process, extract the payload.Return the keys in this cache.Map<K,ICacheElement<K, V>> getMatching(String cacheName, String pattern) Gets multiple items from the cache matching the pattern.Map<K,ICacheElement<K, V>> getMatching(String cacheName, String pattern, long requesterId) Gets multiple items from the cache matching the pattern.Map<K,ICacheElement<K, V>> getMultiple(String cacheName, Set<K> keys) Gets multiple items from the cache based on the given set of keys.Map<K,ICacheElement<K, V>> getMultiple(String cacheName, Set<K> keys, long requesterId) Gets multiple items from the cache based on the given set of keys.voidinitialize(RemoteHttpCacheAttributes attributes) The provides an extension point.booleanisAlive()Make and alive request.protected booleanvoidrelease()Frees the specified cache.voidRemoves the given key from the specified cache.voidRemoves the given key from the specified cache.voidRemove all keys from the specified cache.voidRemove all keys from the specified cache.protected voidsetInitialized(boolean initialized) voidsetRemoteDispatcher(IRemoteCacheDispatcher remoteDispatcher) voidsetRemoteHttpCacheAttributes(RemoteHttpCacheAttributes remoteHttpCacheAttributes) voidupdate(ICacheElement<K, V> item) Puts a cache item to the cache.voidupdate(ICacheElement<K, V> cacheElement, long requesterId) Puts a cache item to the cache.
-
Constructor Details
-
RemoteHttpCacheClient
public RemoteHttpCacheClient()For factory construction. -
RemoteHttpCacheClient
Constructs a client.- Parameters:
attributes-
-
-
Method Details
-
initialize
The provides an extension point. If you want to extend this and use a special dispatcher, here is the place to do it.- Specified by:
initializein interfaceIRemoteHttpCacheClient<K,V> - Parameters:
attributes-
-
get
Create a request, process, extract the payload.- Specified by:
getin interfaceICacheService<K,V> - Parameters:
cacheName-key-- Returns:
- ICacheElement
- Throws:
IOException
-
get
Create a request, process, extract the payload.- Specified by:
getin interfaceICacheServiceNonLocal<K,V> - Parameters:
cacheName-key-requesterId-- Returns:
- ICacheElement
- Throws:
IOException
-
getMatching
Gets multiple items from the cache matching the pattern.- Specified by:
getMatchingin interfaceICacheService<K,V> - Parameters:
cacheName-pattern-- Returns:
- 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
-
getMatching
public Map<K,ICacheElement<K, getMatchingV>> (String cacheName, String pattern, long requesterId) throws IOException Gets multiple items from the cache matching the pattern.- Specified by:
getMatchingin interfaceICacheServiceNonLocal<K,V> - Parameters:
cacheName-pattern-requesterId-- Returns:
- 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
-
getMultiple
Gets multiple items from the cache based on the given set of keys.- Specified by:
getMultiplein interfaceICacheService<K,V> - Parameters:
cacheName-keys-- Returns:
- 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
-
getMultiple
public Map<K,ICacheElement<K, getMultipleV>> (String cacheName, Set<K> keys, long requesterId) throws IOException Gets multiple items from the cache based on the given set of keys.- Specified by:
getMultiplein interfaceICacheServiceNonLocal<K,V> - Parameters:
cacheName-keys-requesterId-- Returns:
- 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
-
remove
Removes the given key from the specified cache.- Specified by:
removein interfaceICacheService<K,V> - Parameters:
cacheName-key-- Throws:
IOException
-
remove
Removes the given key from the specified cache.- Specified by:
removein interfaceICacheServiceNonLocal<K,V> - Parameters:
cacheName-key-requesterId-- Throws:
IOException
-
removeAll
Remove all keys from the specified cache.- Specified by:
removeAllin interfaceICacheService<K,V> - Parameters:
cacheName-- Throws:
IOException
-
removeAll
Remove all keys from the specified cache.- Specified by:
removeAllin interfaceICacheServiceNonLocal<K,V> - Parameters:
cacheName-requesterId-- Throws:
IOException
-
update
Puts a cache item to the cache.- Specified by:
updatein interfaceICacheService<K,V> - Parameters:
item-- Throws:
IOException
-
update
Puts a cache item to the cache.- Specified by:
updatein interfaceICacheServiceNonLocal<K,V> - Parameters:
cacheElement-requesterId-- Throws:
IOException
-
dispose
Frees the specified cache.- Specified by:
disposein interfaceICacheService<K,V> - Parameters:
cacheName-- Throws:
IOException
-
release
Frees the specified cache.- Specified by:
releasein interfaceICacheService<K,V> - Throws:
IOException
-
getKeySet
Return the keys in this cache.- Specified by:
getKeySetin interfaceICacheServiceNonLocal<K,V> - Parameters:
cacheName- the name of the cache- Returns:
- a set of the key type TODO This should probably be done in chunks with a range passed in. This will be a problem if someone puts a 1,000,000 or so items in a region.
- Throws:
IOException- See Also:
-
isAlive
Make and alive request.- Specified by:
isAlivein interfaceIRemoteHttpCacheClient<K,V> - Returns:
- true if we make a successful alive request.
- Throws:
IOException
-
setRemoteDispatcher
- Parameters:
remoteDispatcher- the remoteDispatcher to set
-
getRemoteDispatcher
- Returns:
- the remoteDispatcher
-
setRemoteHttpCacheAttributes
- Parameters:
remoteHttpCacheAttributes- the remoteHttpCacheAttributes to set
-
getRemoteHttpCacheAttributes
- Returns:
- the remoteHttpCacheAttributes
-
setInitialized
- Parameters:
initialized- the initialized to set
-
isInitialized
- Returns:
- the initialized
-