### Question:
CacheConfig { public BlockCache getBlockCache() { return this.blockCache; } CacheConfig(Configuration conf, HColumnDescriptor family);  CacheConfig(Configuration conf);   CacheConfig(final BlockCache blockCache,
      final boolean cacheDataOnRead, final boolean inMemory,
      final boolean cacheDataOnWrite, final boolean cacheIndexesOnWrite,
      final boolean cacheBloomsOnWrite, final boolean evictOnClose,
      final boolean cacheCompressed, final boolean prefetchOnOpen);  CacheConfig(CacheConfig cacheConf); boolean isBlockCacheEnabled(); BlockCache getBlockCache(); boolean shouldCacheDataOnRead(); boolean shouldCacheBlockOnRead(BlockCategory category); boolean isInMemory(); boolean shouldCacheDataOnWrite(); void setCacheDataOnWrite(boolean cacheDataOnWrite); boolean shouldCacheIndexesOnWrite(); boolean shouldCacheBloomsOnWrite(); boolean shouldEvictOnClose(); void setEvictOnClose(boolean evictOnClose); boolean shouldCacheCompressed(); boolean shouldPrefetchOnOpen(); @Override String toString(); static synchronized BlockCache instantiateBlockCache(Configuration conf); static final String CACHE_BLOCKS_ON_WRITE_KEY; static final String CACHE_INDEX_BLOCKS_ON_WRITE_KEY; static final String CACHE_BLOOM_BLOCKS_ON_WRITE_KEY; static final String CACHE_DATA_BLOCKS_COMPRESSED_KEY; static final String EVICT_BLOCKS_ON_CLOSE_KEY; static final String BUCKET_CACHE_IOENGINE_KEY; static final String BUCKET_CACHE_SIZE_KEY; static final String BUCKET_CACHE_PERSISTENT_PATH_KEY; static final String BUCKET_CACHE_COMBINED_KEY; static final String BUCKET_CACHE_COMBINED_PERCENTAGE_KEY; static final String BUCKET_CACHE_WRITER_THREADS_KEY; static final String BUCKET_CACHE_WRITER_QUEUE_KEY; static final boolean DEFAULT_BUCKET_CACHE_COMBINED; static final int DEFAULT_BUCKET_CACHE_WRITER_THREADS; static final int DEFAULT_BUCKET_CACHE_WRITER_QUEUE; static final float DEFAULT_BUCKET_CACHE_COMBINED_PERCENTAGE; static final String SLAB_CACHE_OFFHEAP_PERCENTAGE_KEY; static final String PREFETCH_BLOCKS_ON_OPEN_KEY; static final boolean DEFAULT_CACHE_DATA_ON_READ; static final boolean DEFAULT_CACHE_DATA_ON_WRITE; static final boolean DEFAULT_IN_MEMORY; static final boolean DEFAULT_CACHE_INDEXES_ON_WRITE; static final boolean DEFAULT_CACHE_BLOOMS_ON_WRITE; static final boolean DEFAULT_EVICT_ON_CLOSE; static final boolean DEFAULT_COMPRESSED_CACHE; static final boolean DEFAULT_PREFETCH_ON_OPEN; }### Answer:
@Test public void testSlabCacheConfig() { this.conf.setFloat(CacheConfig.SLAB_CACHE_OFFHEAP_PERCENTAGE_KEY, 0.1f); CacheConfig cc = new CacheConfig(this.conf); basicBlockCacheOps(cc, true, true); assertTrue(cc.getBlockCache() instanceof DoubleBlockCache); }
@Test public void testBucketCacheConfig() { this.conf.set(CacheConfig.BUCKET_CACHE_IOENGINE_KEY, "offheap"); this.conf.setInt(CacheConfig.BUCKET_CACHE_SIZE_KEY, 100); this.conf.setFloat(CacheConfig.BUCKET_CACHE_COMBINED_PERCENTAGE_KEY, 0.8f); CacheConfig cc = new CacheConfig(this.conf); basicBlockCacheOps(cc, false, false); assertTrue(cc.getBlockCache() instanceof CombinedBlockCache); }