Cache Management

Purpose

The J2EE Engine implements the concept of a centralized cache management infrastructure that consolidates caches that are used by various applications in the SAP landscape. This infrastructure has been provided by the Cache Management Library (CML).

Implementation Considerations

The Cache Management Library has been designed in such a way that it satisfies a wide variety of applications that require caching functions. Cache centralization provides the following two benefits for applications:

·        Standardization of cache usage within the SAP landscape

·        Reduced effort for maintaining caches.

Features

The Cache Management Library consists of two logical layers. The first one is visible to cache users and provides the API and functions that users use to access the cached objects they need to work with.

The second layer is not visible to cache users. It contains the implementation logic for storing objects in the cache (storage plug-ins), as well as the eviction policies that are used to determine which objects should be removed from cache when the cache thresholds are reached (eviction policy plug-ins). The pluggable framework used by this layer allows for providing cache users with different cache-usage scenarios by using plug-ins with different logic. For more information, see Cache Variants.

Cache Management Library Architecture

Storage plug-ins can keep cached objects in the memory only. It is possible to use a combination of a storage plug-in and external storage (such as a database or file system as depicted in the graphic above). In this case, the cache objects are serialized and stored on the corresponding external persistent storage.

Eviction policy plug-ins provide an implementation of the algorithm used to determine which cached object must be removed from the cache in case a threshold is reached. There are two types of thresholds for the cache:

·        Cache size – determined by the size of the objects stored in the cache (the size is calculated by the corresponding storage plug-in).

·        Cache objects count.

The cache size threshold takes priority over the cache objects count threshold.