LightMemoryCache 1.0.1
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package LightMemoryCache --version 1.0.1
NuGet\Install-Package LightMemoryCache -Version 1.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LightMemoryCache" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add LightMemoryCache --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: LightMemoryCache, 1.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install LightMemoryCache as a Cake Addin
#addin nuget:?package=LightMemoryCache&version=1.0.1
// Install LightMemoryCache as a Cake Tool
#tool nuget:?package=LightMemoryCache&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
LightMemoryCache
LightMemoryCache is a lightweight, thread-safe, in-memory caching library for .NET applications. It provides a simple and efficient way to cache data objects with customizable expiration times.
Features
- Simple API: Easy-to-use methods for adding, retrieving, and invalidating cached items.
- Thread-Safe: Utilizes ConcurrentDictionary along with the lock statement for thread safety.
- Expiration: Supports customizable expiration times for cached items.
- Automatic Cleanup: Periodically cleans up expired items using a background timer.
- Configurable: Allows configuration of default expiration time via options.
Installation
You can install LightMemoryCache via NuGet Package Manager:
dotnet add package LightMemoryCache
Benchmark
LightMemoryCache vs MemoryCache
Both LightMemoryCache and MemoryCache were benchmarked under similar conditions to evaluate their performance:
Method | Mean | Error | StdDev |
---|---|---|---|
LightMemoryCache_AddAndRetrieve | 12.19 us | 0.029 us | 0.027 us |
MemoryCache_AddAndRetrieve | 13.60 us | 0.149 us | 0.116 us |
LightMemoryCache_AddAndRetrieveComplexObject | 23.83 us | 0.093 us | 0.072 us |
MemoryCache_AddAndRetrieveComplexObject | 34.23 us | 0.083 us | 0.077 us |
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- Microsoft.Extensions.Configuration (>= 8.0.0)
- Microsoft.Extensions.Options (>= 8.0.2)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 8.0.0)
-
net7.0
- Microsoft.Extensions.Configuration (>= 8.0.0)
- Microsoft.Extensions.Options (>= 8.0.2)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 8.0.0)
-
net8.0
- Microsoft.Extensions.Configuration (>= 8.0.0)
- Microsoft.Extensions.Options (>= 8.0.2)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 8.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.