Java Code Examples for org.apache.cassandra.config.DatabaseDescriptor#getKeyCacheKeysToSave()
The following examples show how to use
org.apache.cassandra.config.DatabaseDescriptor#getKeyCacheKeysToSave() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CacheService.java From stratio-cassandra with Apache License 2.0 | 6 votes |
/** * @return auto saving cache object */ private AutoSavingCache<KeyCacheKey, RowIndexEntry> initKeyCache() { logger.info("Initializing key cache with capacity of {} MBs.", DatabaseDescriptor.getKeyCacheSizeInMB()); long keyCacheInMemoryCapacity = DatabaseDescriptor.getKeyCacheSizeInMB() * 1024 * 1024; // as values are constant size we can use singleton weigher // where 48 = 40 bytes (average size of the key) + 8 bytes (size of value) ICache<KeyCacheKey, RowIndexEntry> kc; kc = ConcurrentLinkedHashCache.create(keyCacheInMemoryCapacity); AutoSavingCache<KeyCacheKey, RowIndexEntry> keyCache = new AutoSavingCache<>(kc, CacheType.KEY_CACHE, new KeyCacheSerializer()); int keyCacheKeysToSave = DatabaseDescriptor.getKeyCacheKeysToSave(); keyCache.scheduleSaving(DatabaseDescriptor.getKeyCacheSavePeriod(), keyCacheKeysToSave); return keyCache; }
Example 2
Source File: CacheService.java From stratio-cassandra with Apache License 2.0 | 4 votes |
public int getKeyCacheKeysToSave() { return DatabaseDescriptor.getKeyCacheKeysToSave(); }