13.5.2. LevelDB Cache Store Programmatic Configuration
The following is a sample programmatic configuration of LevelDB Cache Store.
Procedure 13.6. LevelDB Cache Store programmatic configuration
Create a New Configuration Builder
Use theConfigurationBuilderto create a new configuration object.Configuration cacheConfig = new ConfigurationBuilder().persistence()
Configuration cacheConfig = new ConfigurationBuilder().persistence()Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add the LevelDBStoreConfigurationBuilder Store
Add the store to theLevelDBCacheStoreConfigurationBuilderinstance to build its configuration.Configuration cacheConfig = new ConfigurationBuilder().persistence() .addStore(LevelDBStoreConfigurationBuilder.class)Configuration cacheConfig = new ConfigurationBuilder().persistence() .addStore(LevelDBStoreConfigurationBuilder.class)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set Up Location
Set the LevelDB Cache Store location path. The specified path stores the primary cache store data. The directory is automatically created if it does not exist.Configuration cacheConfig = new ConfigurationBuilder().persistence() .addStore(LevelDBStoreConfigurationBuilder.class) .location("/tmp/leveldb/data")Configuration cacheConfig = new ConfigurationBuilder().persistence() .addStore(LevelDBStoreConfigurationBuilder.class) .location("/tmp/leveldb/data")Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set Up Expired Location
Specify the location for expired data using theexpiredLocationparameter for the LevelDB Store. The specified path stores expired data before it is purged. The directory is automatically created if it does not exist.Configuration cacheConfig = new ConfigurationBuilder().persistence() .addStore(LevelDBStoreConfigurationBuilder.class) .location("/tmp/leveldb/data") .expiredLocation("/tmp/leveldb/expired").build();Configuration cacheConfig = new ConfigurationBuilder().persistence() .addStore(LevelDBStoreConfigurationBuilder.class) .location("/tmp/leveldb/data") .expiredLocation("/tmp/leveldb/expired").build();Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Note
Programmatic configurations can only be used with Red Hat JBoss Data Grid Library mode.