@Override public Object decode(CachedData d) { return super.decode(d); }
private <T> ChunkDetails<T> getChunkDetails(String key) { final List<String> firstKeys = new ArrayList<String>(2); firstKeys.add(key); final String firstKey = key + "_00"; firstKeys.add(firstKey); try { final Map<String, CachedData> metadataMap = evcacheMemcachedClient.asyncGetBulk(firstKeys, chunkingTranscoder, null, "GetChunkMetadataOperation") .getSome(readTimeout.get(), TimeUnit.MILLISECONDS, false, false); if (metadataMap.containsKey(key)) { return new ChunkDetails(null, null, false, metadataMap.get(key)); } else if (metadataMap.containsKey(firstKey)) { final ChunkInfo ci = getChunkInfo(firstKey, (String) decodingTranscoder.decode(metadataMap.get( firstKey))); if (ci == null) return null; final List<String> keys = new ArrayList<>(); for (int i = 1; i < ci.getChunks(); i++) { final String prefix = (i < 10) ? "0" : ""; keys.add(ci.getKey() + "_" + prefix + i); } return new ChunkDetails(keys, ci, true, null); } else { return null; } } catch (Exception e) { log.error(e.getMessage(), e); } return null; }
private <T> Single<ChunkDetails<T>> getChunkDetails(String key, Scheduler scheduler) { final List<String> firstKeys = new ArrayList<>(2); firstKeys.add(key); final String firstKey = key + "_00"; firstKeys.add(firstKey); return evcacheMemcachedClient.asyncGetBulk(firstKeys, chunkingTranscoder, null, "GetChunkMetadataOperation") .getSome(readTimeout.get(), TimeUnit.MILLISECONDS, false, false, scheduler) .map(metadataMap -> { if (metadataMap.containsKey(key)) { return new ChunkDetails(null, null, false, metadataMap.get(key)); } else if (metadataMap.containsKey(firstKey)) { final ChunkInfo ci = getChunkInfo(firstKey, (String) decodingTranscoder.decode(metadataMap.get( firstKey))); if (ci == null) return null; final List<String> keys = new ArrayList<>(); for (int i = 1; i < ci.getChunks(); i++) { final String prefix = (i < 10) ? "0" : ""; keys.add(ci.getKey() + "_" + prefix + i); } return new ChunkDetails(keys, ci, true, null); } else { return null; } }); }
for (Entry<String, CachedData> entry : metadataMap.entrySet()) { final String firstKey = entry.getKey(); final String metadata = (String) decodingTranscoder.decode(entry.getValue()); if (metadata == null) continue; final ChunkInfo ci = getChunkInfo(firstKey, metadata);
for (Entry<String, CachedData> entry : metadataMap.entrySet()) { final String firstKey = entry.getKey(); final String metadata = (String) decodingTranscoder.decode(entry.getValue()); if (metadata == null) continue; final ChunkInfo ci = getChunkInfo(firstKey, metadata);
/** * Attempt to get the object represented by the given serialized bytes. */ private Object deserialize() { SerializingTranscoder tc = new SerializingTranscoder(); CachedData d = new CachedData(this.getItemFlags(), this.getValue(), CachedData.MAX_SIZE); Object rv = null; rv = tc.decode(d); return rv; }
/** * Attempt to get the object represented by the given serialized bytes. */ private Object deserialize() { SerializingTranscoder tc = new SerializingTranscoder(); CachedData d = new CachedData(this.getItemFlags(), this.getValue(), CachedData.MAX_SIZE); Object rv = null; rv = tc.decode(d); return rv; }
/** * Attempt to get the object represented by the given serialized bytes. */ private Object deserialize() { SerializingTranscoder tc = new SerializingTranscoder(); CachedData d = new CachedData(this.getItemFlags(), this.getValue(), CachedData.MAX_SIZE); Object rv = null; rv = tc.decode(d); return rv; }