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 TypeMethodDescriptionvoid
Frees 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.void
initialize
(RemoteHttpCacheAttributes attributes) The provides an extension point.boolean
isAlive()
Make and alive request.protected boolean
void
release()
Frees the specified cache.void
Removes the given key from the specified cache.void
Removes the given key from the specified cache.void
Remove all keys from the specified cache.void
Remove all keys from the specified cache.protected void
setInitialized
(boolean initialized) void
setRemoteDispatcher
(IRemoteCacheDispatcher remoteDispatcher) void
setRemoteHttpCacheAttributes
(RemoteHttpCacheAttributes remoteHttpCacheAttributes) void
update
(ICacheElement<K, V> item) Puts a cache item to the cache.void
update
(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:
initialize
in interfaceIRemoteHttpCacheClient<K,
V> - Parameters:
attributes
-
-
get
Create a request, process, extract the payload.- Specified by:
get
in interfaceICacheService<K,
V> - Parameters:
cacheName
-key
-- Returns:
- ICacheElement
- Throws:
IOException
-
get
Create a request, process, extract the payload.- Specified by:
get
in interfaceICacheServiceNonLocal<K,
V> - Parameters:
cacheName
-key
-requesterId
-- Returns:
- ICacheElement
- Throws:
IOException
-
getMatching
Gets multiple items from the cache matching the pattern.- Specified by:
getMatching
in 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:
getMatching
in 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:
getMultiple
in 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:
getMultiple
in 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:
remove
in interfaceICacheService<K,
V> - Parameters:
cacheName
-key
-- Throws:
IOException
-
remove
Removes the given key from the specified cache.- Specified by:
remove
in interfaceICacheServiceNonLocal<K,
V> - Parameters:
cacheName
-key
-requesterId
-- Throws:
IOException
-
removeAll
Remove all keys from the specified cache.- Specified by:
removeAll
in interfaceICacheService<K,
V> - Parameters:
cacheName
-- Throws:
IOException
-
removeAll
Remove all keys from the specified cache.- Specified by:
removeAll
in interfaceICacheServiceNonLocal<K,
V> - Parameters:
cacheName
-requesterId
-- Throws:
IOException
-
update
Puts a cache item to the cache.- Specified by:
update
in interfaceICacheService<K,
V> - Parameters:
item
-- Throws:
IOException
-
update
Puts a cache item to the cache.- Specified by:
update
in interfaceICacheServiceNonLocal<K,
V> - Parameters:
cacheElement
-requesterId
-- Throws:
IOException
-
dispose
Frees the specified cache.- Specified by:
dispose
in interfaceICacheService<K,
V> - Parameters:
cacheName
-- Throws:
IOException
-
release
Frees the specified cache.- Specified by:
release
in interfaceICacheService<K,
V> - Throws:
IOException
-
getKeySet
Return the keys in this cache.- Specified by:
getKeySet
in 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:
isAlive
in 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
-