Telligent Community 6.0 utilizes AppFabric caching, which improves system performance.
The following sections describe cache hierarchy and scope.
Cache hierarchy
Caches are built using one or more layers. These layers sit a top 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.
Understanding cache scope
A cache system consists of three logical locations:
- Context
- Process
- Distributed
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 life span, while Distributed locations should be regarded as having much longer life spans. 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 in which it supports (meaning, the proper CacheScope is specified). By default, a cache supports all scopes. This behavior can be overridden by implementing the ICacheAssignable interface. Built-in caches like HttpContextCache and AspNetCache specify their default scopes by using this interface to specify their locations(Context and Process, respectively). Additionally, scope can be explicitly set programmatically or through attributes when using XML configuration.
Cache scope effect
When items are placed into cache, if a scope was not specified, they are allowed to 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.