@Override public String toString() { return "EVCacheEvent [call=" + call + ", appName=" + appName + ", cacheName=" + cacheName + ", Num of Clients=" + clients.size() + ", keys=" + keys + ", canonicalKeys=" + canonicalKeys + ", ttl=" + ttl + ", cachedData=" + (cachedData != null ? "[ Flags : " + cachedData.getFlags() + "; Data Array length : " +cachedData.getData().length + "] " : "null") + ", Attributes=" + data + "]"; }
@Override public HFileBlock decode(CachedData d) { try { ByteBuff buf = new SingleByteBuff(ByteBuffer.wrap(d.getData())); return (HFileBlock) HFileBlock.BLOCK_DESERIALIZER.deserialize(buf, true, MemoryType.EXCLUSIVE); } catch (IOException e) { LOG.warn("Error deserializing data from memcached",e); } return null; }
@Override public String decode(CachedData d) { return new String(d.getData()); }
protected CachedData getEVCacheValue(String key, CachedData cData, int timeToLive) { final EVCacheValue val = new EVCacheValue(key, cData.getData(), cData.getFlags(), timeToLive, System.currentTimeMillis()); return evcacheValueTranscoder.encode(val); }
+ " is smaller than the key size. Will not be able to proceed. key size = " + key.length()); final int len = cd.getData().length; checksum.update(cd.getData(), 0, len); final long checkSumValue = checksum.getValue(); System.arraycopy(cd.getData(), srcPos, dest, 0, lengthOfArray); if (actualChunkSize > lengthOfArray) { for (int j = lengthOfArray; j < actualChunkSize; j++) {
public EVCacheLatch add(String canonicalKey, CachedData cd, int timeToLive, Policy policy) throws Exception { if (cd == null) return null; addDataSizeSummary.record(cd.getData().length); addTTLSummary.record(timeToLive); final EVCacheClient[] clients = _pool.getEVCacheClientForWrite(); final EVCacheLatchImpl latch = new EVCacheLatchImpl(policy, clients.length - _pool.getWriteOnlyEVCacheClients().length, _appName){ @Override public void onComplete(OperationFuture<?> operationFuture) throws Exception { super.onComplete(operationFuture); if (getPendingFutureCount() == 0 && fixup.get()) { final RemoteRequest req = new RemoteRequest(this, canonicalKey, timeToLive); threadPool.submit(req); } } }; for (EVCacheClient client : clients) { final Future<Boolean> future = client.add(canonicalKey, timeToLive, cd, ct, latch); if(log.isDebugEnabled()) log.debug("ADD : Op Submitted : APP " + _appName + ", key " + canonicalKey + "; future : " + future); } return latch; }
if (log.isDebugEnabled()) log.debug("Chunk Key " + _key + "; Value : " + cd); if (cd == null) continue; final byte[] val = cd.getData(); for (int j = 0; j < ciKeys.size(); j++) { final String skey = ciKeys.get(j); final byte[] sval = dataMap.get(skey).getData(); sb.append(skey + "=" + sval.length + "\n");
if (log.isDebugEnabled()) log.debug("Chunk Key " + _key + "; Value : " + cd); if (cd == null) continue; final byte[] val = cd.getData(); for (int j = 0; j < ciKeys.size(); j++) { final String skey = ciKeys.get(j); final byte[] sval = dataMap.get(skey).getData(); sb.append(skey + "=" + sval.length + "\n");
rv.signalComplete(); } else { Operation op = opFact.store(StoreType.add, key, co.getFlags(), exp, co.getData(), new StoreOperation.Callback() { @Override public void receivedStatus(OperationStatus addStatus) {
final int dataSize = ((CachedData) value).getData().length; if (enableChunking.get() && dataSize > chunkSize.get()) { final CachedData[] cd = createChunks(value, key);
final OperationFuture<Boolean> rv = new EVCacheOperationFuture<Boolean>(key, latch, new AtomicReference<Boolean>(null), connectionFactory.getOperationTimeout(), executorService, appName, serverGroup); final Stopwatch operationDuration = getTimer(AOA_STRING).start(); Operation op = opFact.cat(ConcatenationType.append, 0, key, co.getData(), new OperationCallback() { boolean appendSuccess = false;
final Operation op = opFact.store(storeType, key, co.getFlags(), exp, co.getData(), new StoreOperation.Callback() {
final int dataSize = ((CachedData) value).getData().length;
final EVCacheValue val = new EVCacheValue(canonicalKey, cd.getData(), cd.getFlags(), timeToLive, System.currentTimeMillis()); cd = evcacheValueTranscoder.encode(val); if (cd != null) { if (setDataSizeSummary == null) this.setDataSizeSummary = EVCacheMetricsFactory.getDistributionSummary(_appName + "-SetData-Size", _appName, null); if (setDataSizeSummary != null) this.setDataSizeSummary.record(cd.getData().length);
if (appendDataSizeSummary != null) this.appendDataSizeSummary.record(cd.getData().length);
if (appendDataSizeSummary != null) this.appendDataSizeSummary.record(cd.getData().length);
final EVCacheValue val = new EVCacheValue(canonicalKey, cd.getData(), cd.getFlags(), timeToLive, System.currentTimeMillis()); cd = evcacheValueTranscoder.encode(val); if (cd != null) { if (replaceDataSizeSummary == null) this.replaceDataSizeSummary = EVCacheMetricsFactory.getDistributionSummary(_appName + "-ReplaceData-Size", _appName, null); if (replaceDataSizeSummary != null) this.replaceDataSizeSummary.record(cd.getData().length);
final EVCacheValue val = new EVCacheValue(canonicalKey, cd.getData(), cd.getFlags(), timeToLive, System.currentTimeMillis()); cd = evcacheValueTranscoder.encode(val);