/** * @return the cached partition for @param key if it is already present in the cache. * Not that this will not readAndCache the parition if it is not present, nor * are these calls counted in cache statistics. * * Note that this WILL cause deserialization of a SerializingCache partition, so if all you * need to know is whether a partition is present or not, use containsCachedParition instead. */ public CachedPartition getRawCachedPartition(DecoratedKey key) { if (!isRowCacheEnabled()) return null; IRowCacheEntry cached = CacheService.instance.rowCache.getInternal(new RowCacheKey(metadata.ksAndCFName, key)); return cached == null || cached instanceof RowCacheSentinel ? null : (CachedPartition)cached; }
/** * @return the cached partition for @param key if it is already present in the cache. * Not that this will not readAndCache the parition if it is not present, nor * are these calls counted in cache statistics. * * Note that this WILL cause deserialization of a SerializingCache partition, so if all you * need to know is whether a partition is present or not, use containsCachedParition instead. */ public CachedPartition getRawCachedPartition(DecoratedKey key) { if (!isRowCacheEnabled()) return null; IRowCacheEntry cached = CacheService.instance.rowCache.getInternal(new RowCacheKey(metadata.ksAndCFName, key)); return cached == null || cached instanceof RowCacheSentinel ? null : (CachedPartition)cached; }
/** * @return the cached partition for @param key if it is already present in the cache. * Not that this will not readAndCache the parition if it is not present, nor * are these calls counted in cache statistics. * * Note that this WILL cause deserialization of a SerializingCache partition, so if all you * need to know is whether a partition is present or not, use containsCachedParition instead. */ public CachedPartition getRawCachedPartition(DecoratedKey key) { if (!isRowCacheEnabled()) return null; IRowCacheEntry cached = CacheService.instance.rowCache.getInternal(new RowCacheKey(metadata.ksAndCFName, key)); return cached == null || cached instanceof RowCacheSentinel ? null : (CachedPartition)cached; }
/** * @return the cached row for @param key if it is already present in the cache. * That is, unlike getThroughCache, it will not readAndCache the row if it is not present, nor * are these calls counted in cache statistics. * * Note that this WILL cause deserialization of a SerializingCache row, so if all you * need to know is whether a row is present or not, use containsCachedRow instead. */ public ColumnFamily getRawCachedRow(DecoratedKey key) { if (!isRowCacheEnabled()) return null; IRowCacheEntry cached = CacheService.instance.rowCache.getInternal(new RowCacheKey(metadata.ksAndCFName, key)); return cached == null || cached instanceof RowCacheSentinel ? null : (ColumnFamily)cached; }
public void serialize(KeyCacheKey key, DataOutputPlus out, ColumnFamilyStore cfs) throws IOException { RowIndexEntry entry = CacheService.instance.keyCache.getInternal(key); if (entry == null) return; out.write(cfs.metadata.ksAndCFBytes); ByteBufferUtil.writeWithLength(key.key, out); out.writeInt(key.desc.generation); out.writeBoolean(true); cfs.metadata.comparator.rowIndexEntrySerializer().serialize(entry, out); }
public void serialize(KeyCacheKey key, DataOutputPlus out, ColumnFamilyStore cfs) throws IOException { //Don't serialize old format entries since we didn't bother to implement serialization of both for simplicity //https://issues.apache.org/jira/browse/CASSANDRA-10778 if (!key.desc.version.storeRows()) return; RowIndexEntry entry = CacheService.instance.keyCache.getInternal(key); if (entry == null) return; out.write(cfs.metadata.ksAndCFBytes); ByteBufferUtil.writeWithLength(key.key, out); out.writeInt(key.desc.generation); out.writeBoolean(true); SerializationHeader header = new SerializationHeader(false, cfs.metadata, cfs.metadata.partitionColumns(), EncodingStats.NO_STATS); key.desc.getFormat().getIndexSerializer(cfs.metadata, key.desc.version, header).serializeForCache(entry, out); }
public void serialize(KeyCacheKey key, DataOutputPlus out, ColumnFamilyStore cfs) throws IOException { //Don't serialize old format entries since we didn't bother to implement serialization of both for simplicity //https://issues.apache.org/jira/browse/CASSANDRA-10778 if (!key.desc.version.storeRows()) return; RowIndexEntry entry = CacheService.instance.keyCache.getInternal(key); if (entry == null) return; out.write(cfs.metadata.ksAndCFBytes); ByteBufferUtil.writeWithLength(key.key, out); out.writeInt(key.desc.generation); out.writeBoolean(true); SerializationHeader header = new SerializationHeader(false, cfs.metadata, cfs.metadata.partitionColumns(), EncodingStats.NO_STATS); key.desc.getFormat().getIndexSerializer(cfs.metadata, key.desc.version, header).serializeForCache(entry, out); }
public void serialize(KeyCacheKey key, DataOutputPlus out, ColumnFamilyStore cfs) throws IOException { //Don't serialize old format entries since we didn't bother to implement serialization of both for simplicity //https://issues.apache.org/jira/browse/CASSANDRA-10778 if (!key.desc.version.storeRows()) return; RowIndexEntry entry = CacheService.instance.keyCache.getInternal(key); if (entry == null) return; out.write(cfs.metadata.ksAndCFBytes); ByteBufferUtil.writeWithLength(key.key, out); out.writeInt(key.desc.generation); out.writeBoolean(true); SerializationHeader header = new SerializationHeader(false, cfs.metadata, cfs.metadata.partitionColumns(), EncodingStats.NO_STATS); key.desc.getFormat().getIndexSerializer(cfs.metadata, key.desc.version, header).serializeForCache(entry, out); }