當前位置: 首頁>>代碼示例>>Java>>正文


Java GetAndTouchOperation類代碼示例

本文整理匯總了Java中net.spy.memcached.ops.GetAndTouchOperation的典型用法代碼示例。如果您正苦於以下問題:Java GetAndTouchOperation類的具體用法?Java GetAndTouchOperation怎麽用?Java GetAndTouchOperation使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


GetAndTouchOperation類屬於net.spy.memcached.ops包,在下文中一共展示了GetAndTouchOperation類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getOperationName

import net.spy.memcached.ops.GetAndTouchOperation; //導入依賴的package包/類
public static <T extends Operation> String getOperationName(T operation) {

      //TODO optimize. Convert multiple if/else to switch or map.get()
      String op;
      if (operation instanceof StoreOperation) {
        op = ((StoreOperation) operation).getStoreType().name();
      } else if (operation instanceof ConcatenationOperation) {
        op = ((ConcatenationOperation) operation).getStoreType().name();
      } else if (operation instanceof GetsOperation) {
        op = "get";
      } else if (operation instanceof GetOperation) {
        op = "get";
      } else if (operation instanceof GetAndTouchOperation) {
        op = "gat";
      } else if (operation instanceof MutatorOperation) {
        op = ((MutatorOperation) operation).getType().name();
      } else {
        op = Operations.getOperationName(operation.getClass());
      }
      return op;
    }
 
開發者ID:ApptuitAI,項目名稱:JInsight,代碼行數:22,代碼來源:SpymemcachedRuleHelper.java

示例2: decodePayload

import net.spy.memcached.ops.GetAndTouchOperation; //導入依賴的package包/類
@Override
protected void decodePayload(byte[] pl) {
  final int flags = decodeInt(pl, 0);
  final byte[] data = new byte[pl.length - EXTRA_HDR_LEN];
  System.arraycopy(pl, EXTRA_HDR_LEN, data, 0, pl.length - EXTRA_HDR_LEN);
  GetAndTouchOperation.Callback gcb =
      (GetAndTouchOperation.Callback) getCallback();
  gcb.gotData(key, flags, responseCas, data);
  getCallback().receivedStatus(STATUS_OK);
}
 
開發者ID:Alachisoft,項目名稱:TayzGrid,代碼行數:11,代碼來源:GetAndTouchOperationImpl.java

示例3: asyncGetAndTouch

import net.spy.memcached.ops.GetAndTouchOperation; //導入依賴的package包/類
public <T> EVCacheOperationFuture<CASValue<T>> asyncGetAndTouch(final String key, final int exp, final Transcoder<T> tc) {
    final CountDownLatch latch = new CountDownLatch(1);
    final EVCacheOperationFuture<CASValue<T>> rv = new EVCacheOperationFuture<CASValue<T>>(key, latch, new AtomicReference<CASValue<T>>(null), connectionFactory.getOperationTimeout(), executorService, appName, serverGroup);
    final Stopwatch operationDuration = getTimer(GET_AND_TOUCH_OPERATION_STRING).start();
    Operation op = opFact.getAndTouch(key, exp, new GetAndTouchOperation.Callback() {
        private CASValue<T> val = null;

        public void receivedStatus(OperationStatus status) {
            operationDuration.stop();
            rv.set(val, status);
        }

        public void complete() {
            latch.countDown();
            rv.signalComplete();
        }

        public void gotData(String k, int flags, long cas, byte[] data) {
            if (!key.equals(k)) log.warn("Wrong key returned. Key - {}; Returned Key {}", key, k);
            if (data != null)  {
                if(getAndTouchDataSize == null) getAndTouchDataSize = EVCacheMetricsFactory.getDistributionSummary(appName + "-GATOperation-DataSize", appName, serverGroup.getName());
                if (getAndTouchDataSize != null) getAndTouchDataSize.record(data.length);
            }

            val = new CASValue<T>(cas, tc.decode(new CachedData(flags, data, tc.getMaxSize())));
        }
    });
    rv.setOperation(op);
    mconn.enqueueOperation(key, op);
    return rv;
}
 
開發者ID:Netflix,項目名稱:EVCache,代碼行數:32,代碼來源:EVCacheMemcachedClient.java

示例4: GetAndTouchOperationImpl

import net.spy.memcached.ops.GetAndTouchOperation; //導入依賴的package包/類
public GetAndTouchOperationImpl(String k, int e,
    GetAndTouchOperation.Callback cb) {
  super(GAT_CMD, generateOpaque(), k, cb);
  exp = e;
}
 
開發者ID:Alachisoft,項目名稱:TayzGrid,代碼行數:6,代碼來源:GetAndTouchOperationImpl.java

示例5: getAndTouch

import net.spy.memcached.ops.GetAndTouchOperation; //導入依賴的package包/類
public GetAndTouchOperation getAndTouch(String key, int expiration,
    GetAndTouchOperation.Callback cb) {
  return new GetAndTouchOperationImpl(key, expiration, cb);
}
 
開發者ID:Alachisoft,項目名稱:TayzGrid,代碼行數:5,代碼來源:BinaryOperationFactory.java

示例6: GetAndTouchOperationImpl

import net.spy.memcached.ops.GetAndTouchOperation; //導入依賴的package包/類
public GetAndTouchOperationImpl(String c, int e,
    GetAndTouchOperation.Callback cb, String k) {
  super(c, e, cb, k);
}
 
開發者ID:Alachisoft,項目名稱:TayzGrid,代碼行數:5,代碼來源:GetAndTouchOperationImpl.java

示例7: getAndTouch

import net.spy.memcached.ops.GetAndTouchOperation; //導入依賴的package包/類
public GetAndTouchOperation getAndTouch(String key, int expiration,
    GetAndTouchOperation.Callback cb) {
  throw new UnsupportedOperationException("Get and touch is not supported "
      + "for ASCII protocol");
}
 
開發者ID:Alachisoft,項目名稱:TayzGrid,代碼行數:6,代碼來源:AsciiOperationFactory.java

示例8: getAndTouch

import net.spy.memcached.ops.GetAndTouchOperation; //導入依賴的package包/類
/**
 * Gets the value of a key and resets its timeout.
 *
 * @param key the key to get a value for and reset its timeout
 * @param expiration the new expiration for the key
 * @param cb the callback that will contain the result
 * @return a new GATOperation
 */
GetAndTouchOperation getAndTouch(String key, int expiration,
    GetAndTouchOperation.Callback cb);
 
開發者ID:Alachisoft,項目名稱:TayzGrid,代碼行數:11,代碼來源:OperationFactory.java


注:本文中的net.spy.memcached.ops.GetAndTouchOperation類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。