PostSharp Caching

The straightforward way to improve your application performance.

Add caching to an existing method with just a custom attribute.
Works with Redis, MemoryCache, and your custom cache framework.

[CacheConfiguration( AbsoluteExpiration = 10 )]
class CustomerServices
{
    [Cache]
    public static Customer GetCustomer(int id)
    {
       // Details skipped.
    }

    [InvalidateCache(nameof(GetCustomer))]
    public static void UpdateCustomer(int id, string newName)
    {
        // Parameter 'id' of 'GetCustomer' method matched by name.
        // Details skipped. 
    }

}

Key Features

  • Declarative caching and cache invalidation – using compiler-verified custom attributes.
  • Out-of-the-box support for MemoryCache and Redis.
  • Object-oriented dependencies for strongly-typed cache invalidation.
  • Customizable. Plug into your own cache storage.
  • Support for async methods and async cache storages.

Key Benefits

  • Deliver faster with fewer lines of code.
  • Write cleaner code.
  • Reduce errors related to cache key generation and invalidation.

Deployment Scenarios

  • MemoryCache for local in-memory caching.
  • Redis for distributed caching.
  • MemoryCache+Redis for lower latency.
  • MemoryCache with Pub/Sub invalidation for low-cost distributed caching.
Break free from routine TODAY and start delivering more in less time. download
10% of Fortune 500 companies have already made the choice.