Multi Tenant EH Cache Support

Summary

Installation

grails install-plugin multi-tenant-ehcache

Description

This plugin supports the single-tenant mode of the multi-tenant pluign. This is the case where each tenant has their
own individual database separate from the other tenants. This requires some additional work when managing the 2nd
level cache which is needed in most application for performance tuning. This plugin attempts to make the management
of the second level cache transparent to the user of the multi-tenant plugin. This process is cache provider specific and
this plugin component supports ehcache. There is a plugin component that supports OS Cache as well.

You do not need this plugin if you are using the multi-tenant mode of the Multi-Tenant plugin. This plugin is only needed for the single-tenant mode.

Architecture

This plugin provides a plugin cache provider that intercepts the calls to provide a 2nd level cache to Hibernate. It then determines the current tenant
and either retrieves a cache or creates a cache for that tenant. The cache provided is a proxy to the real cache. each cache is prepended with the
tenant id. The plugin also provides a set of management console screens to allow you to view overall cache performance and detailed performance
of each tenants caching scheme down to the individual items in each cache. The support is for the older style of EH Cache which is being replaced and we are looking at how to implement the new style

Configuration

Configuration of this plugin is very simple. It does require the previous installation of either of the multi tenant core plugins. You then add
the following to the datasource.groovy file to replace the current cache provided with the multi tenant one.

That is all there is to it and now when you start up your application 2nd level caching will support multi-tenant.

Console Configuration

This plugin is built using the dynamic controller plugin so the console controllers are provided as mixins to existing controllers. If you want to
add the console support you will need to add the following to your config.groovy file