Creating a Custom Infinispan Cache for Palettes

Introduction

Palettes' UCCE GED-145 adapter stores all contextual data it is passed from the client in an Infinispan cache, named: UCCEAdapterDataCache

The cache-container that this cache is part of is defined in the adapter's configuration component (the app-config WAR file) - specifically the services.xml within this component.

This cache is created by the Palettes server using inbuilt Infinispan cache defaults, which see to it that the entries never expire.

Although this configuration is satisfactory for POC installations, it is recommended that the cache's configuration be changed when deploying Palettes into production environments.

If the cache that the adapter stores its data in does not already exist within the configured cache-container, then Palettes will create it.

Due to the way the cache is created, it cannot be modified as-is.

In order for Palettes to use a cache with the required configuration, a new cache must be created.

This article explains:

  • How to create a new cache and
  • How to configure it appropriately


Creating a new cache

By default, the UCCE GED-145 adapter is configured to use a cache-container named: container-shared

The adapter is configured internally to use a cache named 'UCCEAdapterDataCache' from within the defined cache-container.

If the cache that the adapter stores its data in does not already exist within the configured cache-container, the adapter will create it.

The following steps show how to create a cache named UCCEAdapterDataCache within a specified cache-container, ensuring the adapter uses this custom cache, rather than creating its own.

  1. Login to the JBoss admin console
  2. Navigate to the 'Replicated Caches' page:

        Profiles > Profile: ha > Subsystems > Infinispan > Replicated Caches

  3. Click Add to create a new cache
      - Set its name to: UCCEAdapterDataCache
      - Select the cache-container: container-shared
      - Leave the clustered cache mode as the default: SYNC
  4. Click Save

The new cache will have been created and its details will have been written to JBoss's domain.xml.

 

Configuring the newly created cache

Once the cache has been created, it needs configuring.

The instructions below explain how to ensure the cache is backed by a file, and how to configure it such that it expires the data appropriately.

  1. Navigate to the configuration directory containing the domain.xml - i.e <FAS_INSTALL_DIR>/domain/configuration/

  2. Edit the domain.xml
  3. Locate the newly created cache within the domain.xml by searching for: UCCEAdapterDataCache

      - The cache's definition will look like the following and will be part of the cache-container section named 'container-shared'

<replicated-cache name="UCCEAdapterDataCache" mode="SYNC"/>


  4. Update this cache definition as follows:

<replicated-cache name="UCCEAdapterDataCache" mode="SYNC" start="EAGER">

    <expiration max-idle="600000" lifespan="10000"/>

    <file-store shared="false" preload="true" passivation="false" fetch-state="true" purge="false" singleton="false"/>

</replicated-cache>

 

      - NOTE: The example 'expiration' definition above has set the maximum idle time that a cache entry will be maintained in the cache to be 10 minutes. After this time, the entry will be expired. The definition has also set the lifespan of a cache entry to 10 seconds, so 10 seconds after the entry has expired, it will be removed.

      - NOTE: The file element is optional. If it is removed, the cache will not be written a file. 

  5. Save the changes to the domain.xml

  6. Restart the Fusion Application Server (FAS) - e.g. service fas restart

 

Verifying the new cache

Upon restart of FAS, the newly created cache's configuration will be active. 

Assuming the cache is backed by a file (as described above), a new folder will have been created named after the newly created cache i.e. UCCEAdapterDataCache. This will contain all data stored by the Palettes UCCE GED-145 adapter.

The location of the cache's folder is:

<FAS_INSTALL_DIR>/domain/servers/appserver-xxxx/data/infinispan/container-shared/UCCEAdapterDataCache

 

 

Comments are disabled on these articles if you require help contact support@cafex.com.

Have more questions? Submit a request

Comments

Powered by Zendesk