Skip to content

Commit

Permalink
review comments + adding more debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
srrangarajan committed Aug 21, 2022
1 parent 0251d0f commit ea7b3f0
Show file tree
Hide file tree
Showing 6 changed files with 183 additions and 67 deletions.
99 changes: 65 additions & 34 deletions evcache-core/src/main/java/com/netflix/evcache/EVCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;

import javax.annotation.Nullable;
Expand All @@ -18,12 +16,10 @@
import org.slf4j.LoggerFactory;

import com.google.common.annotations.VisibleForTesting;
import com.netflix.archaius.api.PropertyRepository;
import com.netflix.evcache.EVCacheLatch.Policy;
import com.netflix.evcache.operation.EVCacheItem;
import com.netflix.evcache.operation.EVCacheItemMetaData;
import com.netflix.evcache.pool.EVCacheClientPoolManager;
import com.netflix.evcache.util.EVCacheConfig;

import net.spy.memcached.transcoders.Transcoder;
import rx.Scheduler;
Expand Down Expand Up @@ -70,7 +66,7 @@
* @author smadappa
*/
public interface EVCache {

// TODO: Remove Async methods (Project rx) and rename COMPLETABLE_* with ASYNC_*
public static enum Call {
GET, GETL, GET_AND_TOUCH, ASYNC_GET, BULK, SET, DELETE, INCR, DECR, TOUCH, APPEND, PREPEND, REPLACE, ADD, APPEND_OR_ADD, GET_ALL, META_GET, META_SET, META_DEBUG,
COMPLETABLE_FUTURE_GET, COMPLETABLE_FUTURE_GET_BULK
Expand Down Expand Up @@ -475,13 +471,32 @@ <T> EVCacheLatch replace(String key, T value, Transcoder<T> tc, int timeToLive,
* any more requests or issues during deserialization or any IO
* Related issues
*
* Note: If the data is replicated by zone, then we can the
* Note: If the data is replicated by zone, then we can get 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;

/**
* Async 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. The max length of the key (including prefix)
* is 250 characters.
* @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 get 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> CompletableFuture<T> getAsync(String key) throws EVCacheException;
/**
* Retrieve the value for the given key.
Expand Down Expand Up @@ -514,15 +529,15 @@ <T> EVCacheLatch replace(String key, T value, Transcoder<T> tc, int timeToLive,
* any more requests or issues during deserialization or any IO
* Related issues
*
* Note: If the data is replicated by zone, then we can the
* Note: If the data is replicated by zone, then we can get 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;

/**
* Retrieve the value for the given a key using the specified Transcoder for
* Async Retrieve the value for the given a key using the specified Transcoder for
* deserialization.
*
* @param key
Expand All @@ -538,7 +553,7 @@ <T> EVCacheLatch replace(String key, T value, Transcoder<T> tc, int timeToLive,
* any more requests or issues during deserialization or any IO
* Related issues
*
* Note: If the data is replicated by zone, then we can the
* Note: If the data is replicated by zone, then we can get 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.
Expand Down Expand Up @@ -585,7 +600,7 @@ default EVCacheItemMetaData metaDebug(String key) throws EVCacheException {
* any more requests or issues during deserialization or any IO
* Related issues
*
* Note: If the data is replicated by zone, then we can the
* Note: If the data is replicated by zone, then we can get the
* value from the zone local to the client. If we cannot find
* this value we retry other zones, if still not found, then null is returned.
*/
Expand Down Expand Up @@ -614,7 +629,7 @@ default <T> EVCacheItem<T> metaGet(String key, Transcoder<T> tc) throws EVCacheE
* any more requests or issues during deserialization or any IO
* Related issues
*
* Note: If the data is replicated by zone, then we can the
* Note: If the data is replicated by zone, then we can get 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.
Expand All @@ -628,7 +643,7 @@ default <T> EVCacheItem<T> metaGet(String key, Transcoder<T> tc) throws EVCacheE
* @param key
* key to get. Ensure the key is properly encoded and does not
* contain whitespace or control characters. The max length of the key (including prefix)
* is 250 characters.
* is 200 characters.
* @param tc
* the Transcoder to deserialize the data
* @param scheduler
Expand All @@ -645,7 +660,7 @@ default <T> EVCacheItem<T> metaGet(String key, Transcoder<T> tc) throws EVCacheE
* @param key
* key to get. Ensure the key is properly encoded and does not
* contain whitespace or control characters. The max length of the key (including prefix)
* is 250 characters.
* is 200 characters.
* @param timeToLive
* the new expiration of this object i.e. less than 30 days in
* seconds or the exact expiry time as UNIX time
Expand All @@ -663,7 +678,7 @@ default <T> EVCacheItem<T> metaGet(String key, Transcoder<T> tc) throws EVCacheE
* @param key
* key to get. Ensure the key is properly encoded and does not
* contain whitespace or control characters. The max length of the key (including prefix)
* is 250 characters.
* is 200 characters.
* @param timeToLive
* the new expiration of this object i.e. less than 30 days in
* seconds or the exact expiry time as UNIX time
Expand All @@ -684,7 +699,7 @@ default <T> EVCacheItem<T> metaGet(String key, Transcoder<T> tc) throws EVCacheE
* @param key
* the key to get. Ensure the key is properly encoded and does
* not contain whitespace or control characters. The max length of the key (including prefix)
* is 250 characters.
* is 200 characters.
* @param timeToLive
* the new expiration of this object i.e. less than 30 days in
* seconds or the exact expiry time as UNIX time
Expand All @@ -702,7 +717,7 @@ default <T> EVCacheItem<T> metaGet(String key, Transcoder<T> tc) throws EVCacheE
* @param key
* the key to get. Ensure the key is properly encoded and does
* not contain whitespace or control characters. The max length of the key (including prefix)
* is 250 characters.
* is 200 characters.
* @param timeToLive
* the new expiration of this object i.e. less than 30 days in
* seconds or the exact expiry time as UNIX time
Expand All @@ -722,7 +737,7 @@ default <T> EVCacheItem<T> metaGet(String key, Transcoder<T> tc) throws EVCacheE
* @param keys
* the keys for which we need the values. Ensure each key is properly encoded and does
* not contain whitespace or control characters. The max length of the key (including prefix)
* is 250 characters.
* is 200 characters.
* @return a map of the values (for each value that exists). If the Returned
* map contains the key but the value in null then the key does not
* exist in the cache. if a key is missing then we were not able to
Expand All @@ -734,7 +749,23 @@ default <T> EVCacheItem<T> metaGet(String key, Transcoder<T> tc) throws EVCacheE
*/
<T> Map<String, T> getBulk(String... keys) throws EVCacheException;

<T> CompletableFuture<Map<String, T>> getBulkCompletableFuture(String... keys) throws EVCacheException, ExecutionException, InterruptedException;
/**
* Async Retrieve the value of a set of keys.
*
* @param keys
* the keys for which we need the values. Ensure each key is properly encoded and does
* not contain whitespace or control characters. The max length of the key (including prefix)
* is 200 characters.
* @return a map of the values (for each value that exists). If the Returned
* map contains the key but the value in null then the key does not
* exist in the cache. if a key is missing then we were not able to
* retrieve the data for that key due to some exception
* @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
*/
<T> CompletableFuture<Map<String, T>> getAsyncBulk(String... keys);

/**
* Retrieve the value for a set of keys, using a specified Transcoder for
Expand All @@ -743,7 +774,7 @@ default <T> EVCacheItem<T> metaGet(String key, Transcoder<T> tc) throws EVCacheE
* @param keys
* keys to which we need the values.Ensure each key is properly encoded and does
* not contain whitespace or control characters. The max length of the key (including prefix)
* is 250 characters.
* is 200 characters.
* @param tc
* the transcoder to use for deserialization
* @return a map of the values (for each value that exists). If the Returned
Expand All @@ -764,7 +795,7 @@ default <T> EVCacheItem<T> metaGet(String key, Transcoder<T> tc) throws EVCacheE
* @param keys
* The collection of keys for which we need the values. Ensure each key is properly encoded and does
* not contain whitespace or control characters. The max length of the key (including prefix)
* is 250 characters.
* is 200 characters.
* @return a map of the values (for each value that exists). If the Returned
* map contains the key but the value in null then the key does not
* exist in the cache. if a key is missing then we were not able to
Expand All @@ -783,7 +814,7 @@ default <T> EVCacheItem<T> metaGet(String key, Transcoder<T> tc) throws EVCacheE
* @param keys
* The collection of keys for which we need the values. Ensure each key is properly encoded and does
* not contain whitespace or control characters. The max length of the key (including prefix)
* is 250 characters.
* is 200 characters.
* @param tc
* the transcoder to use for deserialization
* @return a map of the values (for each value that exists). If the Returned
Expand All @@ -804,7 +835,7 @@ default <T> EVCacheItem<T> metaGet(String key, Transcoder<T> tc) throws EVCacheE
* @param keys
* The collection of keys for which we need the values. Ensure each key is properly encoded and does
* not contain whitespace or control characters. The max length of the key (including prefix)
* is 250 characters.
* is 200 characters.
* @param tc
* the transcoder to use for deserialization
* @param timeToLive
Expand All @@ -830,7 +861,7 @@ <T> Map<String, T> getBulkAndTouch(Collection<String> keys, Transcoder<T> tc, in
* the key for which we need the value. Ensure the key is
* properly encoded and does not contain whitespace or control
* characters. The max length of the key (including prefix)
* is 250 characters.
* is 200 characters.
* @return the Futures containing the Value or null.
* @throws EVCacheException
* in the circumstance where queue is too full to accept any
Expand All @@ -850,7 +881,7 @@ <T> Map<String, T> getBulkAndTouch(Collection<String> keys, Transcoder<T> tc, in
* the key for which we need the value. Ensure the key is
* properly encoded and does not contain whitespace or control
* characters. The max length of the key (including prefix)
* is 250 characters.
* is 200 characters.
* @param tc
* the transcoder to use for deserialization
* @return the Futures containing the Value or null.
Expand All @@ -871,7 +902,7 @@ <T> Map<String, T> getBulkAndTouch(Collection<String> keys, Transcoder<T> tc, in
* the key. Ensure the key is
* properly encoded and does not contain whitespace or control
* characters. The max length of the key (including prefix)
* is 250 characters.
* is 200 characters.
* @param by
* the amount to increment
* @param def
Expand All @@ -893,7 +924,7 @@ <T> Map<String, T> getBulkAndTouch(Collection<String> keys, Transcoder<T> tc, in
* the key. Ensure the key is
* properly encoded and does not contain whitespace or control
* characters. The max length of the key (including prefix)
* is 250 characters.
* is 200 characters.
* @param by
* the amount to decrement
* @param def
Expand All @@ -917,7 +948,7 @@ <T> Map<String, T> getBulkAndTouch(Collection<String> keys, Transcoder<T> tc, in
* the key under which this object should be appended. Ensure the
* key is properly encoded and does not contain whitespace or
* control characters. The max length of the key (including prefix)
* is 250 characters.
* is 200 characters.
* @param T
* the value to be appended
* @param tc
Expand All @@ -944,7 +975,7 @@ <T> Map<String, T> getBulkAndTouch(Collection<String> keys, Transcoder<T> tc, in
* the key under which this object should be appended. Ensure the
* key is properly encoded and does not contain whitespace or
* control characters. The max length of the key (including prefix)
* is 250 characters.
* is 200 characters.
* @param T
* the value to be appended
* @param timeToLive
Expand All @@ -969,7 +1000,7 @@ <T> Map<String, T> getBulkAndTouch(Collection<String> keys, Transcoder<T> tc, in
* the key which this object should be added to. Ensure the
* key is properly encoded and does not contain whitespace or
* control characters. The max length of the key (including prefix)
* is 250 characters.
* is 200 characters.
* @param T
* the value to be added
* @param tc
Expand Down Expand Up @@ -997,7 +1028,7 @@ <T> Map<String, T> getBulkAndTouch(Collection<String> keys, Transcoder<T> tc, in
* the key which this object should be added to. Ensure the
* key is properly encoded and does not contain whitespace or
* control characters. The max length of the key (including prefix)
* is 250 characters.
* is 200 characters.
* @param T
* the value to be added
* @param tc
Expand Down Expand Up @@ -1029,7 +1060,7 @@ <T> Map<String, T> getBulkAndTouch(Collection<String> keys, Transcoder<T> tc, in
* the key to touch. Ensure the
* key is properly encoded and does not contain whitespace or
* control characters. The max length of the key (including prefix)
* is 250 characters.
* is 200 characters.
* @param ttl
* the new expiration time in seconds
*
Expand All @@ -1050,7 +1081,7 @@ <T> Map<String, T> getBulkAndTouch(Collection<String> keys, Transcoder<T> tc, in
* the key to touch. Ensure the
* key is properly encoded and does not contain whitespace or
* control characters. The max length of the key (including prefix)
* is 250 characters.
* is 200 characters.
* @param ttl
* the new expiration time in seconds
*
Expand Down Expand Up @@ -1078,7 +1109,7 @@ <T> Map<String, T> getBulkAndTouch(Collection<String> keys, Transcoder<T> tc, in
* the key under which this object should be appended or Added. Ensure the
* key is properly encoded and does not contain whitespace or
* control characters. The max length of the key (including prefix)
* is 250 characters.
* is 200 characters.
* @param T
* the value to be appended
* @param tc
Expand All @@ -1105,7 +1136,7 @@ <T> Map<String, T> getBulkAndTouch(Collection<String> keys, Transcoder<T> tc, in
* the key under which this object should be appended or Added. Ensure the
* key is properly encoded and does not contain whitespace or
* control characters. The max length of the key (including prefix)
* is 250 characters.
* is 200 characters.
* @param T
* the value to be appended
* @param tc
Expand Down
Loading

0 comments on commit ea7b3f0

Please sign in to comment.