Looking for something specific?
  Home
Home
Articles
Page Tag-Cloud
  Software
Software Tag-Cloud
Building from Source
Open Source Definition
All Software
  Popular Tags
Legacy
C Plus Plus
Source Code
Class
Cryptography
  Members
Login
Web-Email
Notable Members
  Official
Our Company
Copyright Information
Software EULA
GPL EULA
LGPL Eula
Pre-Release EULA
Privacy Policy
  Support
Make Contact
 
NTDLS.FastMemoryCache
Downloads   0
User Rating   (Rate)
Last Updated   12/7/2023
License   MIT License
- Download -
View all Releases
Recommended Release
Version   1.5.0
Date   12/7/2023
Status   Stable Stable software is believed to be stable and ready for production use.

This software is open source. You can obtain the latest source code from the GitHub repository or browse the releases for the source code associated with a specific release. If you make any changes which you feel improves this application, please let us know via our Contact Page.

NTDLS.FastMemoryCache

?? Be sure to check out the NuGet pacakge: https://www.nuget.org/packages/NTDLS.FastMemoryCache

Provides fast and easy to use thread-safe partitioned memory cache for C# that helps manage the maximum size and track performance.

?? This memory cache was developed to deal with caches containing large numbers of items. When working on a database server written in C# we found that we had significant contention around the cache. This project was the solution. It also allowed us to better manage the size of the cache and enforce max memory constraints. That said, if you are only caching a few dozen items - stick with IMemoryCache.

Quick and easy eample of a file cache:

Using the memory cache is easy, just initialize and upsert some values. You can also pass a configuration parameter to set max memory size, cache scavange rate and partition count.

readonly PartitionedMemoryCache _cache = new();

public string ReadFileFromDisk(string path)
{
    string cacheKey = path.ToLower();

    if (_cache.TryGet<string>(cacheKey, out var cachedObject))
    {
        return cachedObject;
    }

    string fileContents = File.ReadAllText(path);
    _cache.Upsert(cacheKey, fileContents, fileContents.Length * sizeof(char));
    return fileContents;
}

License

Apache-2.0


Recent Releases:
 1.5.0    1.4.4    1.4.3  

Tags:
 Cache    Fast Cache    Managed Cache    Memory    Memory Cache    Partitioned Cache    Thread Safe  

No comments currently exists for this software. Why don't you add one?
First Previous Next Last 

 
Copyright © 2024 NetworkDLS.
All rights reserved.
 
Privacy Policy | Our Company | Contact