Infinispan Concepts

From NovaOrdis Knowledge Base
Jump to navigation Jump to search

Internal

Cache Container

A cache container is the runtime structure that instantiates and manages one or more caches. In case of clustered caches, the cache container encapsulates the networking mechanisms required to maintain state across more than one JVM for its caches, including a JGroups stack.

Each cache container declares a set of caches that share a global configuration, so caches belonging to different cache containers can have different transport configurations, optimized for different use cases.

The cache container implementations are heavyweight objects. There should be possible to use just one cache container per JVM, unless specific configuration requires the availability of more than one instance - but in this case there will be a minimal and finite number of such instances.

A WildFly cache container is the WildFly service wrapper around an Infinispan cache container. Each <cache-container> element eventually results in a org.infinispan.manager.DefaultCacheManager instance being created in the JVM.

The corresponding WildFly/JDG configuration element is <cache-container>. The <cache-container> elements are children of the "infinispan" (for WildFly) or "infinispan:server:core:" (for JDG) subsystems. More details about cache container configuration can be found here:

Cache Container Configuration

From an API perspective, the cache container is the primary API mechanism to retrieve cache instances or create cache instances on demand.

Cache Manager

A cache manager and a cache container represent similar concepts.

Cache

Default Cache and Named Caches

Each cache container has a default cache instance. The default cache can be retrieved via the CacheManager.getCache() API.

Named caches are retrieved via CacheManager.getCache(String name) API. Therefore, note that the name attribute of named cache is both mandatory and unique for every named cache specified. Named caches have the same XML schema as the default cache so they inherit settings from the default cache while additional behavior can be specified or overridden.

The default cache for a specific cache container is configured using the default-cache configuration attribute.

Connecting to an Infinispan Server

HotRot

The HotRod connector is configured in the infinispan:server:endpoint Section.

memcached

The memcached connector is configured in the infinispan:server:endpoint Section.

REST

The REST connector is configured in the infinispan:server:endpoint Section.