org.apache.cassandra.service

## Class CacheService

- java.lang.Object
- - org.apache.cassandra.service.CacheService

All Implemented Interfaces:
  CacheServiceMBean

    public class CacheService
    extends java.lang.Object
    implements CacheServiceMBean

### Nested Class Summary

Nested Classes
`static class` `CacheService.CacheType`
`static class` `CacheService.CounterCacheSerializer`
`static class` `CacheService.KeyCacheSerializer`
`static class` `CacheService.RowCacheSerializer`

### Field Summary

Fields
`AutoSavingCache<CounterCacheKey,ClockAndCount>` `counterCache`
`static CacheService` `instance`
`AutoSavingCache<KeyCacheKey,RowIndexEntry>` `keyCache`
`static java.lang.String` `MBEAN_NAME`
`AutoSavingCache<RowCacheKey,IRowCacheEntry>` `rowCache`

### Method Summary

All Methods Instance Methods Concrete Methods
`int` `getCounterCacheKeysToSave()`
`int` `getCounterCacheSavePeriodInSeconds()`
`int` `getKeyCacheKeysToSave()`
`int` `getKeyCacheSavePeriodInSeconds()`
`int` `getRowCacheKeysToSave()`
`int` `getRowCacheSavePeriodInSeconds()`
`void` `invalidateCounterCache()`
`void` `invalidateCounterCacheForCf(Pair<java.lang.String,java.lang.String> ksAndCFName)`
`void` `invalidateKeyCache()` invalidate the key cache; for use after invalidating row cache
`void` `invalidateKeyCacheForCf(Pair<java.lang.String,java.lang.String> ksAndCFName)`
`void` `invalidateRowCache()` invalidate the row cache; for use after bulk loading via BinaryMemtable
`void` `invalidateRowCacheForCf(Pair<java.lang.String,java.lang.String> ksAndCFName)`
`void` `saveCaches()` save row and key caches
`void` `setCounterCacheCapacityInMB(long capacity)`
`void` `setCounterCacheKeysToSave(int count)`
`void` `setCounterCacheSavePeriodInSeconds(int seconds)`
`void` `setKeyCacheCapacityInMB(long capacity)`
`void` `setKeyCacheKeysToSave(int count)`
`void` `setKeyCacheSavePeriodInSeconds(int seconds)`
`void` `setRowCacheCapacityInMB(long capacity)`
`void` `setRowCacheKeysToSave(int count)`
`void` `setRowCacheSavePeriodInSeconds(int seconds)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### MBEAN_NAME

    public static final java.lang.String MBEAN_NAME

See Also:
  Constant Field Values

#### instance

    public static final CacheService instance

#### keyCache

    public final AutoSavingCache<KeyCacheKey,RowIndexEntry> keyCache

#### rowCache

    public final AutoSavingCache<RowCacheKey,IRowCacheEntry> rowCache

#### counterCache

    public final AutoSavingCache<CounterCacheKey,ClockAndCount> counterCache

### Method Detail

#### getRowCacheSavePeriodInSeconds

    public int getRowCacheSavePeriodInSeconds()

Specified by:
  `getRowCacheSavePeriodInSeconds` in interface `CacheServiceMBean`

#### setRowCacheSavePeriodInSeconds

    public void setRowCacheSavePeriodInSeconds(int seconds)

Specified by:
  `setRowCacheSavePeriodInSeconds` in interface `CacheServiceMBean`

#### getKeyCacheSavePeriodInSeconds

    public int getKeyCacheSavePeriodInSeconds()

Specified by:
  `getKeyCacheSavePeriodInSeconds` in interface `CacheServiceMBean`

#### setKeyCacheSavePeriodInSeconds

    public void setKeyCacheSavePeriodInSeconds(int seconds)

Specified by:
  `setKeyCacheSavePeriodInSeconds` in interface `CacheServiceMBean`

#### getCounterCacheSavePeriodInSeconds

    public int getCounterCacheSavePeriodInSeconds()

Specified by:
  `getCounterCacheSavePeriodInSeconds` in interface `CacheServiceMBean`

#### setCounterCacheSavePeriodInSeconds

    public void setCounterCacheSavePeriodInSeconds(int seconds)

Specified by:
  `setCounterCacheSavePeriodInSeconds` in interface `CacheServiceMBean`

#### getRowCacheKeysToSave

    public int getRowCacheKeysToSave()

Specified by:
  `getRowCacheKeysToSave` in interface `CacheServiceMBean`

#### setRowCacheKeysToSave

    public void setRowCacheKeysToSave(int count)

Specified by:
  `setRowCacheKeysToSave` in interface `CacheServiceMBean`

#### getKeyCacheKeysToSave

    public int getKeyCacheKeysToSave()

Specified by:
  `getKeyCacheKeysToSave` in interface `CacheServiceMBean`

#### setKeyCacheKeysToSave

    public void setKeyCacheKeysToSave(int count)

Specified by:
  `setKeyCacheKeysToSave` in interface `CacheServiceMBean`

#### getCounterCacheKeysToSave

    public int getCounterCacheKeysToSave()

Specified by:
  `getCounterCacheKeysToSave` in interface `CacheServiceMBean`

#### setCounterCacheKeysToSave

    public void setCounterCacheKeysToSave(int count)

Specified by:
  `setCounterCacheKeysToSave` in interface `CacheServiceMBean`

#### invalidateKeyCache

    public void invalidateKeyCache()

Description copied from interface: `CacheServiceMBean`
invalidate the key cache; for use after invalidating row cache

Specified by:
  `invalidateKeyCache` in interface `CacheServiceMBean`

#### invalidateKeyCacheForCf

    public void invalidateKeyCacheForCf(Pair<java.lang.String,java.lang.String> ksAndCFName)

#### invalidateRowCache

    public void invalidateRowCache()

Description copied from interface: `CacheServiceMBean`
invalidate the row cache; for use after bulk loading via BinaryMemtable

Specified by:
  `invalidateRowCache` in interface `CacheServiceMBean`

#### invalidateRowCacheForCf

    public void invalidateRowCacheForCf(Pair<java.lang.String,java.lang.String> ksAndCFName)

#### invalidateCounterCacheForCf

    public void invalidateCounterCacheForCf(Pair<java.lang.String,java.lang.String> ksAndCFName)

#### invalidateCounterCache

    public void invalidateCounterCache()

Specified by:
  `invalidateCounterCache` in interface `CacheServiceMBean`

#### setRowCacheCapacityInMB

    public void setRowCacheCapacityInMB(long capacity)

Specified by:
  `setRowCacheCapacityInMB` in interface `CacheServiceMBean`

#### setKeyCacheCapacityInMB

    public void setKeyCacheCapacityInMB(long capacity)

Specified by:
  `setKeyCacheCapacityInMB` in interface `CacheServiceMBean`

#### setCounterCacheCapacityInMB

    public void setCounterCacheCapacityInMB(long capacity)

Specified by:
  `setCounterCacheCapacityInMB` in interface `CacheServiceMBean`

#### saveCaches

    public void saveCaches()
                    throws java.util.concurrent.ExecutionException,
                           java.lang.InterruptedException

Description copied from interface: `CacheServiceMBean`
save row and key caches

Specified by:
  `saveCaches` in interface `CacheServiceMBean`
Throws:
  `java.util.concurrent.ExecutionException` - when attempting to retrieve the result of a task that aborted by throwing an exception
  `java.lang.InterruptedException` - when a thread is waiting, sleeping, or otherwise occupied, and the thread is interrupted, either before or during the activity.