/** * This method will remove the cache for a given key * * @param keys */ public void invalidateAll(List<K> keys) { for (K key : keys) { cache.invalidate(key); } }
@Override public void clear(Segment segment) { Set<String> shards = segmentMap.remove(segment.getSegmentNo()); if (shards != null) { for (String shard : shards) { for (CarbonColumn carbonColumn : dataMapMeta.getIndexedColumns()) { cache.invalidate(new BloomCacheKeyValue.CacheKey(shard, carbonColumn.getColName())); } } } }
/** * This method will remove dictionary cache from driver for both reverse and forward dictionary * * @param carbonTableIdentifier * @param columnId */ public static void removeDictionaryColumnFromCache(AbsoluteTableIdentifier carbonTableIdentifier, String columnId) { Cache<DictionaryColumnUniqueIdentifier, Dictionary> dictCache = CacheProvider.getInstance().createCache(CacheType.REVERSE_DICTIONARY); DictionaryColumnUniqueIdentifier dictionaryColumnUniqueIdentifier = new DictionaryColumnUniqueIdentifier(carbonTableIdentifier, new ColumnIdentifier(columnId, null, null)); dictCache.invalidate(dictionaryColumnUniqueIdentifier); dictCache = CacheProvider.getInstance().createCache(CacheType.FORWARD_DICTIONARY); dictCache.invalidate(dictionaryColumnUniqueIdentifier); } }
@Override public void clear(Segment segment) { Set<TableBlockIndexUniqueIdentifier> blockIndexes = segmentMap.remove(segment.getSegmentNo()); if (blockIndexes != null) { for (TableBlockIndexUniqueIdentifier blockIndex : blockIndexes) { TableBlockIndexUniqueIdentifierWrapper blockIndexWrapper = new TableBlockIndexUniqueIdentifierWrapper(blockIndex, this.getCarbonTable()); BlockletDataMapIndexWrapper wrapper = cache.getIfPresent(blockIndexWrapper); if (null != wrapper) { List<BlockDataMap> dataMaps = wrapper.getDataMaps(); for (DataMap dataMap : dataMaps) { if (dataMap != null) { cache.invalidate(blockIndexWrapper); dataMap.clear(); } } } } } }