Package io.vertx.ext.web.client.spi
Interface CacheStore
-
public interface CacheStore
An API to store and retrieve HTTP responses.- Author:
- Craig Day
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static CacheStore
build()
Builds a no-op cache store.Future<Void>
delete(io.vertx.ext.web.client.impl.cache.CacheKey key)
Delete a key from the cache.default void
delete(io.vertx.ext.web.client.impl.cache.CacheKey key, Handler<AsyncResult<Void>> handler)
Delete all variations of a key from the cache.Future<Void>
flush()
Delete all entries from the cache.default void
flush(Handler<AsyncResult<Void>> handler)
Delete all entries from the cache.Future<io.vertx.ext.web.client.impl.cache.CachedHttpResponse>
get(io.vertx.ext.web.client.impl.cache.CacheKey key)
Retrieve a cached response.default void
get(io.vertx.ext.web.client.impl.cache.CacheKey key, Handler<AsyncResult<io.vertx.ext.web.client.impl.cache.CachedHttpResponse>> handler)
Retrieve a cached response.static CacheStore
localStore()
Builds a cache store that uses aConcurrentHashMap
.Future<io.vertx.ext.web.client.impl.cache.CachedHttpResponse>
set(io.vertx.ext.web.client.impl.cache.CacheKey key, io.vertx.ext.web.client.impl.cache.CachedHttpResponse response)
Add a response in the cache with the given key.default void
set(io.vertx.ext.web.client.impl.cache.CacheKey key, io.vertx.ext.web.client.impl.cache.CachedHttpResponse response, Handler<AsyncResult<io.vertx.ext.web.client.impl.cache.CachedHttpResponse>> handler)
Add a response in the cache with the given key.static CacheStore
sharedDataStore(Vertx vertx)
Builds a cache store that uses anAsyncMap
fromSharedData
.
-
-
-
Method Detail
-
build
static CacheStore build()
Builds a no-op cache store.- Returns:
- the new cache store
-
sharedDataStore
static CacheStore sharedDataStore(Vertx vertx)
Builds a cache store that uses anAsyncMap
fromSharedData
.- Parameters:
vertx
- the vertx instance- Returns:
- the new cache store
-
localStore
static CacheStore localStore()
Builds a cache store that uses aConcurrentHashMap
.- Returns:
- the new cache store
-
get
Future<io.vertx.ext.web.client.impl.cache.CachedHttpResponse> get(io.vertx.ext.web.client.impl.cache.CacheKey key)
Retrieve a cached response.- Parameters:
key
- the key to retrieve- Returns:
- the response as stored in the cache
-
set
Future<io.vertx.ext.web.client.impl.cache.CachedHttpResponse> set(io.vertx.ext.web.client.impl.cache.CacheKey key, io.vertx.ext.web.client.impl.cache.CachedHttpResponse response)
Add a response in the cache with the given key.- Parameters:
key
- the key to store the response atresponse
- the response to store- Returns:
- the response
-
delete
Future<Void> delete(io.vertx.ext.web.client.impl.cache.CacheKey key)
Delete a key from the cache.- Parameters:
key
- the key to delete- Returns:
- a future so the API can be composed fluently
-
flush
Future<Void> flush()
Delete all entries from the cache.- Returns:
- a future so the API can be composed fluently
-
get
default void get(io.vertx.ext.web.client.impl.cache.CacheKey key, Handler<AsyncResult<io.vertx.ext.web.client.impl.cache.CachedHttpResponse>> handler)
Retrieve a cached response.- Parameters:
key
- the key to retrievehandler
- a handler to receive the cached response- See Also:
get(CacheKey)
-
set
default void set(io.vertx.ext.web.client.impl.cache.CacheKey key, io.vertx.ext.web.client.impl.cache.CachedHttpResponse response, Handler<AsyncResult<io.vertx.ext.web.client.impl.cache.CachedHttpResponse>> handler)
Add a response in the cache with the given key.- Parameters:
key
- the key to store the response atresponse
- the response to storehandler
- a handler to receive the stored response- See Also:
set(CacheKey, CachedHttpResponse)
-
delete
default void delete(io.vertx.ext.web.client.impl.cache.CacheKey key, Handler<AsyncResult<Void>> handler)
Delete all variations of a key from the cache.- Parameters:
key
- the key to deletehandler
- a handler to receive the delete result- See Also:
delete(CacheKey)
-
flush
default void flush(Handler<AsyncResult<Void>> handler)
Delete all entries from the cache.- Parameters:
handler
- a handler to receive the flush result.- See Also:
flush()
-
-