Infinispan ServerがWildFlyベースでできているようなので、同じように管理CLIからCacheの定義がきっとできるんだろうと思い、試してみたらふつうにできたのでメモ。
さきほどのエントリでも、Cacheは全部管理CLIから追加しました。
Infinispan Server 7ことはじめ
http://d.hatena.ne.jp/Kazuhira/20141110/1415606647
とりあえず、Infinispan Serverを起動。
$ ./infinispan-server-7.0.0.Final/bin/standalone.sh
管理CLIから接続。
$ ./infinispan-server-7.0.0.Final/bin/jboss-cli.sh -c [standalone@localhost:9990 /]
Cacheの追加。
[standalone@localhost:9990 /] /subsystem=infinispan/cache-container=local/local-cache=hotrodCache:add() {"outcome" => "success"}
削除。
[standalone@localhost:9990 /] /subsystem=infinispan/cache-container=local/local-cache=hotrodCache:remove() {"outcome" => "success"}
有効期限付きCacheの定義。先にCacheを作って
[standalone@localhost:9990 /] /subsystem=infinispan/cache-container=local/local-cache=hotrodWithExpiredCache:add() {"outcome" => "success"}
設定追加。
[standalone@localhost:9990 /] /subsystem=infinispan/cache-container=local/local-cache=hotrodWithExpiredCache/expiration=EXPIRATION:add(lifespan=5000, max-idle=3000) { "outcome" => "success", "response-headers" => { "operation-requires-reload" => true, "process-state" => "reload-required" } }
この場合は、再起動が必要らしいですね。
[standalone@localhost:9990 /] reload
また、さっきのlifespan、max-idleみたいな複数設定を
[standalone@localhost:9990 /] /subsystem=infinispan/cache-container=local/local-cache=hotrodWithExpiredCache/expiration=EXPIRATION:add(lifespan=5000) { "outcome" => "success", "response-headers" => { "operation-requires-reload" => true, "process-state" => "reload-required" } }
と先に片方定義して
[standalone@localhost:9990 /] /subsystem=infinispan/cache-container=local/local-cache=hotrodWithExpiredCache/expiration=EXPIRATION:add(max-idle=3000) { "outcome" => "failed", "failure-description" => "JBAS014803: Duplicate resource [ (\"subsystem\" => \"infinispan\"), (\"cache-container\" => \"local\"), (\"local-cache\" => \"hotrodWithExpiredCache\"), (\"expiration\" => \"EXPIRATION\") ]", "rolled-back" => true, "response-headers" => {"process-state" => "reload-required"} }
とすると、エラーになるみたいなのでaddではなくてwrite-attributeすればよいみたい。
[standalone@localhost:9990 /] /subsystem=infinispan/cache-container=local/local-cache=hotrodWithExpiredCache/expiration=EXPIRATION:write-attribute(name=max-idle, value=3000) { "outcome" => "success", "response-headers" => { "operation-requires-reload" => true, "process-state" => "reload-required" } }
個別に削除する場合は、undefine-attribute。
[standalone@localhost:9990 /] /subsystem=infinispan/cache-container=local/local-cache=hotrodWithExpiredCache/expiration=EXPIRATION:undefine-attribute(name=max-idle) { "outcome" => "success", "response-headers" => { "operation-requires-reload" => true, "process-state" => "reload-required" } }
WildFlyで初めて使った時はだいぶオロオロしましたが、なんとか使えそうです。