Monday, June 21, 2010

Writing wrapper of caching frameworks, part2

Hi this post is about the structure of the Caching System for the Logic Module. I`ve already presented my structure, listened to question/comments and something changed it.

The main goal of this caching system is to wrap a caching framework and provide the interface for required features for us. Rest upon previous post where I made a review of simplified structure of two caching frameworks I designed a structure of the Caching System for the Logic Service.

Here is it:


















LogicCacheManager - utilitny class, provides a cache by its name, keeps Map of caches as well as a link to LogicCacheProvider.

LogicCacheProvider - class hides a control of the CacheManager of the certain caching framework. It is an abstract class. Contains a list of all created logicCaches.

LogicCache - the interface that is necessary to implement, which hides a cache of the certain caching framework, provides all the necessary methods: get, put, getSize etc. Some methods may throw IllegalOperationException, this means cachig framework behind it doesn`t support such features. Also it has getFeature method which take argument LogicCache.Feature type which is internal enumeration. Using "boolean getFeature(Feature)" we can ask our logicCache about what features are supported.

LogicCacheConfig - interface, provides access to manage some parameters of the cache at the runtime. For example: max size of the cache in the memory, default ttl for objects in cache etc. Like LogicCache it has internal enumeration LogicCacheConfig.Features and getFeature method to ask about what methods are supported.

Next post I`ll write about LogicCacheKey, serialization, how to test it.

No comments:

Post a Comment