13.5.2. LevelDB キャッシュストアのプログラムを使用した設定
以下は、LevelDB キャッシュストアのプログラミンによる設定例です。
手順13.6 LevelDB キャッシュストアのプログラムを使用した設定
新規の設定ビルダーを作成します。
ConfigurationBuilderを使用して、新規の設定オブジェクトを作成します。Configuration cacheConfig = new ConfigurationBuilder().persistence()
Configuration cacheConfig = new ConfigurationBuilder().persistence()Copy to Clipboard Copied! Toggle word wrap Toggle overflow LevelDBStoreConfigurationBuilder ストアを追加します。
ストアをLevelDBCacheStoreConfigurationBuilderインスタンスに追加して、その設定を構築します。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 ロケーションのセットアップ
LevelDB キャッシュストアのロケーションパスを設定します。指定したパスは、主なキャッシュストアデータを保存します。ディレクトリーがない場合は自動的に作成されます。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 期限切れのロケーションのセットアップ
LevelDB ストアのexpiredLocationパラメーターを使用して、期限切れデータのロケーションを指定します。指定されたパスは、パージされる前に期限切れデータを保存します。ディレクトリーがない場合は自動的に作成されます。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
注記
プログラムを使用した設定は、Red Hat JBoss Data Grid ライブラリーモードのみで利用できます。