Kre.Caching.InMemory 3.0.0

Kre.Caching.InMemory

Overview

Kre.Caching.InMemory is a .NET library that provides a pass-through implementation of the MemoryCache with additional support for async operations. It allows developers to utilize the features of MemoryCache while extending its capabilities for asynchronous usage.

  • Features

  • Pass-through MemoryCache Implementation: Provides a pass-through implementation of MemoryCache with additional support for async operations.
  • Supports Async Operations: Supports asynchronous operations for adding, retrieving, and updating items in the cache.
  • Flexible Usage: Offers a flexible API for interacting with the cache, allowing developers to easily store, retrieve, and remove items.
  • Expiry Support: Supports caching with expiration, enabling developers to specify expiration policies for cached items.
  • Singleton Default Instance: Kre.Caching.InMemory includes a singleton default instance for easy access to the caching functionality throughout the application. Developers can leverage this default instance to simplify caching operations and improve code readability.
  • Injection: Easily integrates with IServiceCollection.

Installation

To install Kre.Caching.InMemory in your project, you can use NuGet Package Manager:

Requirements

  • .NET 8.0 or later

Usage

Here's a basic example demonstrating how to use Kre.Caching.InMemory in your application:

using Kre.Caching.InMemory;

// Create a cache instance
var cache = Cache.Default;

// Add an item to the cache
cache.Set("myKey", "myValue");

// Retrieve the item from the cache
var value = cache.Get<string>("myKey");
Console.WriteLine(value); // Output: myValue

No packages depend on Kre.Caching.InMemory.

.NET 9.0

Version Downloads Last updated
3.0.0 15 03/02/2025
2.0.0 21 02/08/2025
1.2.0 12 02/08/2025
1.1.1 13 07/06/2024
1.1.0 33 06/21/2024