The entry point to configure PostSharp.Patterns.Caching at run time.
Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching.dll
Syntax
public static class CachingServicesRemarks
The cached methods that do not receive an ICachingService from dependency injection use DefaultService. Set its Backend property before the first call to a cached method; otherwise, the call throws a CachingException. Use Profiles to change the configuration of cached methods at run time, CachingServices.Invalidation to remove items from the cache, CurrentContext to add dependencies to the cached method being evaluated, and KeyBuilder or CachingServices.Formatters to customize cache keys.
This class registers DefaultService as the ICachingService of RunTimeServiceLocator, unless
the application registered another one first. An object whose class receives its caching service from dependency injection, and that is
created with new, therefore uses DefaultService.
Properties
| Name | Description |
|---|---|
| CurrentContext | Gets the current caching context, so dependencies can be added. |
| DefaultBackend | Gets or sets the CachingBackend of DefaultService. |
| DefaultKeyBuilder | Gets or sets the CacheKeyBuilder of DefaultService. |
| DefaultService | Gets the ICachingService used by the cached methods that do not receive a service from dependency injection, i.e. the result of DefaultServiceLocator. |
| DefaultServiceLocator | Gets or sets the delegate that returns DefaultService. By default, it returns a CachingService created
by this class. Setting this property to |
| Profiles | Gets the repository of caching profiles (CachingProfile) of DefaultService. |
Methods
| Name | Description |
|---|---|
| SuspendDependencyPropagation() | Temporarily suspends propagation of dependencies from subsequently called methods to the caller method. |