Skip to content

Commit

Permalink
Added asynchronous get method
Browse files Browse the repository at this point in the history
  • Loading branch information
rdegnan committed Mar 1, 2016
1 parent c5022e9 commit 5ed6d7b
Show file tree
Hide file tree
Showing 10 changed files with 535 additions and 348 deletions.
7 changes: 7 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ subprojects {
repositories {
jcenter()
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

configurations.all {
exclude group: 'com.netflix.rxjava'
}
}

task wrapper(type: Wrapper) {
Expand Down
1 change: 1 addition & 0 deletions evcache-client/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ dependencies {
compile group:"com.netflix.servo", name:"servo-core", version:"latest.release"
compile group:"com.netflix.spectator", name:"spectator-api", version:"latest.release"
compile group:"com.netflix.spectator", name:"spectator-nflx-plugin", version:"latest.release"
compile group:"io.reactivex", name:"rxjava", version:"latest.release"
compile group:"org.slf4j", name:"slf4j-log4j12", version:"latest.release"
compile group:"org.slf4j", name:"slf4j-api", version:"latest.release"
testCompile group:"org.testng", name:"testng", version:"latest.release"
Expand Down
100 changes: 15 additions & 85 deletions evcache-client/src/main/java/com/netflix/evcache/EVCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import net.spy.memcached.transcoders.Transcoder;
import rx.Observable;
import rx.Scheduler;
import rx.Single;

/**
* An abstract interface for interacting with an Ephemeral Volatile Cache.
Expand Down Expand Up @@ -415,119 +416,55 @@ <T> EVCacheLatch replace(String key, T value, Transcoder<T> tc, int timeToLive,
* @param key
* key to get. Ensure the key is properly encoded and does not
* contain whitespace or control characters.
* @param listener
* Listener that will be notified when the operation is
* completed.
* @return the Value for the given key from the cache (null if there is
* none).
* @throws EVCacheException
* in the rare circumstance where queue is too full to accept
* any more requests or issues during deserialization or any IO
* Related issues
*
*
* Note: If the data is replicated by zone, then we can the
* value from the zone local to the client. If we cannot find
* this value then null is returned. This is transparent to the
* users.
*
* @deprecated This is a sub-optimal operation does not support Retries, Fast Failures, FIT, GC Detection, etc.
* Will be removed in a subsequent release
*
*/
<T> void get(String key, EVCacheGetOperationListener<T> listener) throws EVCacheException;
<T> T get(String key) throws EVCacheException;

/**
* Retrieve the value for the given key.
*
* @param key
* key to get. Ensure the key is properly encoded and does not
* contain whitespace or control characters.
* @param tc
* the Transcoder to deserialize the data
* @param listener
* Listener that will be notified when the operation is
* completed.
* @param scheduler
* the {@link Scheduler} to perform subscription actions on
* @return the Value for the given key from the cache (null if there is
* none).
* @throws EVCacheException
* in the rare circumstance where queue is too full to accept
* any more requests or issues during deserialization or any IO
* Related issues
*
* Note: If the data is replicated by zone, then we can the
* value from the zone local to the client. If we cannot find
* this value then null is returned. This is transparent to the
* users.
*
* @deprecated This is a sub-optimal operation does not support Retries, Fast Failures, FIT, GC Detection, etc.
* Will be removed in a subsequent release
*/
@Deprecated
<T> void get(String key, Transcoder<T> tc, EVCacheGetOperationListener<T> listener) throws EVCacheException;

/**
* Retrieve the value for the given key and return the {@link rx.Observable}
* . {@link rx.Subscriber}'s of the {@link rx.Observable} will be notified
* when the data is obtained from the remote cache.
*
* @param key
* key to get. Ensure the key is properly encoded and does not
* contain whitespace or control characters.
* @param requestProperties
* Additional properties that are part of the request.
* @return the {@link rx.Observable} that will be notified when the data is
* fetched.
* @throws EVCacheException
* in the rare circumstance where queue is too full to accept
* any more requests or issues during deserialization or any IO
* Related issues
*
* @deprecated This is a sub-optimal operation does not support Retries, Fast Failures, FIT, GC Detection, etc.
* Will be removed in a subsequent release
*/
@Deprecated
<T> Observable<T> observeGet(String key, Scheduler scheduler) throws EVCacheException;
<T> Single<T> get(String key, Scheduler scheduler);

/**
* Retrieve the value for the given key and return the {@link rx.Observable}
* . {@link rx.Subscriber}'s of the {@link rx.Observable} will be notified
* when the data is obtained from the remote cache.
*
* @param key
* key to get. Ensure the key is properly encoded and does not
* contain whitespace or control characters.
* @return the {@link rx.Observable} that will be notified when the data is
* fetched.
* @throws EVCacheException
* in the rare circumstance where queue is too full to accept
* any more requests or issues during deserialization or any IO
* Related issues
*
* @deprecated This is a sub-optimal operation does not support Retries, Fast Failures, FIT, GC Detection, etc.
* Will be removed in a subsequent release
*/
@Deprecated
<T> Observable<T> observeGet(String key) throws EVCacheException;

/**
* Retrieve the value for the given key.
* Retrieve the value for the given a key using the specified Transcoder for
* deserialization.
*
* @param key
* key to get. Ensure the key is properly encoded and does not
* contain whitespace or control characters.
* @param tc
* the Transcoder to deserialize the data
* @return the Value for the given key from the cache (null if there is
* none).
* @throws EVCacheException
* in the rare circumstance where queue is too full to accept
* any more requests or issues during deserialization or any IO
* Related issues
*
*
* Note: If the data is replicated by zone, then we can the
* value from the zone local to the client. If we cannot find
* this value then null is returned. This is transparent to the
* users.
*/
<T> T get(String key) throws EVCacheException;
<T> T get(String key, Transcoder<T> tc) throws EVCacheException;

/**
* Retrieve the value for the given a key using the specified Transcoder for
Expand All @@ -538,19 +475,12 @@ <T> EVCacheLatch replace(String key, T value, Transcoder<T> tc, int timeToLive,
* contain whitespace or control characters.
* @param tc
* the Transcoder to deserialize the data
* @param scheduler
* the {@link Scheduler} to perform subscription actions on
* @return the Value for the given key from the cache (null if there is
* none).
* @throws EVCacheException
* in the rare circumstance where queue is too full to accept
* any more requests or issues during deserialization or any IO
* Related issues
*
* Note: If the data is replicated by zone, then we can the
* value from the zone local to the client. If we cannot find
* this value then null is returned. This is transparent to the
* users.
*/
<T> T get(String key, Transcoder<T> tc) throws EVCacheException;
<T> Single<T> get(String key, Transcoder<T> tc, Scheduler scheduler);

/**
* Get with a single key and reset its expiration.
Expand Down
Loading

0 comments on commit 5ed6d7b

Please sign in to comment.