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 theConfigurationBuilder
to create a new configuration object.Configuration cacheConfig = new ConfigurationBuilder().persistence()
Add the LevelDBStoreConfigurationBuilder Store
Add the store to theLevelDBCacheStoreConfigurationBuilder
instance to build its configuration.Configuration cacheConfig = new ConfigurationBuilder().persistence() .addStore(LevelDBStoreConfigurationBuilder.class)
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")
Set Up Expired Location
Specify the location for expired data using theexpiredLocation
parameter 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();
Note
Programmatic configurations can only be used with Red Hat JBoss Data Grid Library mode.