此内容没有您所选择的语言版本。

13.3. Cache Containers


Cache Containers
A cache container is repository for the caches used by a subsystem. For Infinispan default cache containers are defined in the configuration xml files (standalone-ha.xml, standalone-full-ha.xml, domain.xml). One cache is defined as the default cache, which is the cache that will be used for clustering.

Example 13.1. Cache container definitions from standalone-ha.xml configuration file

<subsystem xmlns="urn:jboss:domain:infinispan:1.5">
       <cache-container name="singleton" aliases="cluster ha-partition" default-cache="default">
          <transport lock-timeout="60000"/>
          <replicated-cache name="default" mode="SYNC" batching="true">
             <locking isolation="REPEATABLE_READ"/>
          </replicated-cache>
       </cache-container>
       <cache-container name="web" aliases="standard-session-cache" default-cache="repl" module="org.jboss.as.clustering.web.infinispan">
        <transport lock-timeout="60000"/>
        <replicated-cache name="repl" mode="ASYNC" batching="true">
          <file-store/>
        </replicated-cache>
        <replicated-cache name="sso" mode="SYNC" batching="true"/>
          <distributed-cache name="dist" l1-lifespan="0" mode="ASYNC" batching="true">
           <file-store/>
          </distributed-cache>
        </cache-container>
Copy to Clipboard Toggle word wrap
Note the default cache defined in each cache container. In this example, in the web cache container, the repl cache is defined as the default. The repl cache will therefore be used when clustering web sessions.
The cache containers and cache attributes can be configured using the Management Console or CLI commands, but it is not advisable to change the names of either cache containers or caches.
Configure Cache Containers
Cache containers for Infinispan can be configured using the CLI or the Management Console.

Procedure 13.1. Configure the Infinispan Cache Containers in the Management Console

  1. Select the Configuration tab from the top of the screen.
  2. For Domain mode only, select either ha or full-ha from the drop down menu at top left.
  3. Expand the Subsystems menu, then expand the Infinispan menu. Select Cache Containers.
  4. Select a cache container from the Cache Containers table.
  5. Add, Remove or Set Default Cache Container

    1. To create a new cache container, click Add from the Cache Containers table.
    2. To remove a cache container, select the cache container in the Cache Containers table. Click Remove and click OK to confirm.
    3. To set a cache container as default, click Set Default, enter a cache container name from the drop down list, click Save to confirm.
  6. To add or update the attributes of a cache container, select the cache container in the Cache Containers table. Select one from the Attributes, Transport and Aliases tabs in the Details area of the screen, and click Edit. For help about the content of the Attributes, Transport and Aliases tabs, click Need Help?.

Procedure 13.2. Configure the Infinispan Cache Containers in the Management CLI

  1. To get a list of configurable attributes, enter the following CLI command:
    /profile=profile name/subsystem=infinispan/cache-container=container name:read-resource
    Copy to Clipboard Toggle word wrap
  2. You can use the Management CLI to add, remove and update cache containers. Before issuing any commands to do with cache containers, ensure that you use the correct profile in the Management CLI command.
    1. Add a Cache Container

      To add a cache container base your command on the following example:
      /profile=profile-name/subsystem=infinispan/cache-container="cache container name":add
      Copy to Clipboard Toggle word wrap
    2. Remove a Cache Container

      To remove a cache container base your command on the following example:
      /profile=profile-name/subsystem=infinispan/cache-container="cache container name":remove
      Copy to Clipboard Toggle word wrap
    3. Update Cache Container attributes

      Use the write-attribute operation to write a new value to an attribute. You can use tab completion to help complete the command string as you type, as well as to expose the available attributes. The following example updates statistics-enabled to true.
      /profile=profile name/subsystem=infinispan/cache-container=cache container name:write-attribute(name=statistics-enabled,value=true)
      Copy to Clipboard Toggle word wrap
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat