Zimbra Community 8.0 utilizes AppFabric caching, which improves system performance. The following sections describe cache hierarchy and scope.
Caches are built using one or more layers. These layers sit atop each other to form a stack, or cache hierarchy. When requests come to the cache system, the request is processed in the order specified by the cache stack. This allows specific ordering for caches so that faster caches are searched first followed by increasingly slower caches.
A cache system consists of three logical locations:
Each of these locations is no more than a marker that indicates assumptions. For example, Context locations should be thought of as having a small lifespan, while Distributed locations should be regarded as having much longer lifespans. The exact lifespans are defined by the caches themselves.
Caches are configured to support these locations. When a request is given to a cache, the cache determines if the requesting scope is one which it supports (meaning the proper CacheScope is specified). By default, a cache supports all scopes. However, this can be overridden by implementing the ICacheAssignable interface. Built-in caches like HttpContextCache and AspNetCache specify their default scopes with this interface in order to specify their locations (Context and Process, respectively). Additionally, scope can be explicitly set programatically or through attributes when using XML configuration.
When items are placed into cache, if a scope was not specified, they can be placed into any CacheScope location. Each cache layer's scope is checked to ensure that the cache supports the scope requested. If it does, the item is entered into the cache. Otherwise, the object is not inserted into the cache and the next cache in the stack is checked. This occurs until all caches are processed.
Suppose we have a cache configured to have two layers of cache: HttpContextCache (which supports the Context scope) and AspNetCache (which supports the Process scope). If an item is entered into the cache:
- With scope = Context, Process, Distributed
then HttpContextCache and AspNetCache would be used.
- With scope = Context, Distributed
then HttpContextCache would be used, but AspNetCache would not. AspNetCache would not be used because it does not support Context or Distributed.