Class SpyMemcached<T>

Type Parameters:
T -
All Implemented Interfaces:
DistributedCacheClient<T>

public class SpyMemcached<T> extends AbstractDistributedCacheClient<T>
Since:
0.8
Author:
Haiyang Li
  • Constructor Details

    • SpyMemcached

      public SpyMemcached(String serverUrl)
      Parameters:
      serverUrl -
    • SpyMemcached

      public SpyMemcached(String serverUrl, long timeout)
      Parameters:
      serverUrl -
      timeout -
  • Method Details

    • get

      public T get(String key)
      Parameters:
      key -
      Returns:
    • asyncGet

      public Future<T> asyncGet(String key)
      Parameters:
      key -
      Returns:
    • getBulk

      @SafeVarargs public final Map<String,T> getBulk(String... keys)
      Gets the bulk.
      Specified by:
      getBulk in interface DistributedCacheClient<T>
      Overrides:
      getBulk in class AbstractDistributedCacheClient<T>
      Parameters:
      keys -
      Returns:
    • asyncGetBulk

      @SafeVarargs public final Future<Map<String,T>> asyncGetBulk(String... keys)
      Async get bulk.
      Parameters:
      keys -
      Returns:
    • getBulk

      public Map<String,T> getBulk(Collection<String> keys)
      Gets the bulk.
      Specified by:
      getBulk in interface DistributedCacheClient<T>
      Overrides:
      getBulk in class AbstractDistributedCacheClient<T>
      Parameters:
      keys -
      Returns:
    • asyncGetBulk

      public Future<Map<String,T>> asyncGetBulk(Collection<String> keys)
      Async get bulk.
      Parameters:
      keys -
      Returns:
    • set

      public boolean set(String key, T obj, long liveTime)
      Parameters:
      key -
      obj -
      liveTime -
      Returns:
      true, if successful
    • asyncSet

      public Future<Boolean> asyncSet(String key, T obj, long liveTime)
      Parameters:
      key -
      obj -
      liveTime -
      Returns:
    • add

      public boolean add(String key, T obj, long liveTime)
      Parameters:
      key -
      obj -
      liveTime -
      Returns:
      true, if successful
    • asyncAdd

      public Future<Boolean> asyncAdd(String key, T obj, long liveTime)
      Parameters:
      key -
      obj -
      liveTime -
      Returns:
    • replace

      public boolean replace(String key, T obj, long liveTime)
      Parameters:
      key -
      obj -
      liveTime -
      Returns:
      true, if successful
    • asyncReplace

      public Future<Boolean> asyncReplace(String key, T obj, long liveTime)
      Parameters:
      key -
      obj -
      liveTime -
      Returns:
    • delete

      public boolean delete(String key)
      Parameters:
      key -
      Returns:
      true, if successful
    • asyncDelete

      public Future<Boolean> asyncDelete(String key)
      Parameters:
      key -
      Returns:
    • incr

      public long incr(String key)
      Parameters:
      key -
      Returns:
    • incr

      public long incr(String key, int deta)
      Parameters:
      key -
      deta -
      Returns:
    • incr

      public long incr(String key, int deta, long defaultValue)
      Parameters:
      key -
      deta -
      defaultValue -
      Returns:
    • incr

      public long incr(String key, int deta, long defaultValue, long liveTime)
      Parameters:
      key -
      deta -
      defaultValue -
      liveTime -
      Returns:
    • decr

      public long decr(String key)
      Parameters:
      key -
      Returns:
    • decr

      public long decr(String key, int deta)
      Parameters:
      key -
      deta -
      Returns:
    • decr

      public long decr(String key, int deta, long defaultValue)
      Parameters:
      key -
      deta -
      defaultValue -
      Returns:
    • decr

      public long decr(String key, int deta, long defaultValue, long liveTime)
      Parameters:
      key -
      deta -
      defaultValue -
      liveTime -
      Returns:
    • flushAll

      public void flushAll()
      Flush all.
      Specified by:
      flushAll in interface DistributedCacheClient<T>
      Overrides:
      flushAll in class AbstractDistributedCacheClient<T>
    • asyncFlushAll

      public Future<Boolean> asyncFlushAll()
      Async flush all.
      Returns:
    • flushAll

      public boolean flushAll(long delay)
      Parameters:
      delay -
      Returns:
      true, if successful
    • asyncFlushAll

      public Future<Boolean> asyncFlushAll(long delay)
      Async flush all.
      Parameters:
      delay -
      Returns:
    • disconnect

      public void disconnect()
      Disconnect.
    • disconnect

      public void disconnect(long timeout)
      Parameters:
      timeout -