Click here to Skip to main content
15,895,142 members
Articles / Programming Languages / C#

A Lightweight Thread Safe In-Memory Keyed Generic Cache Collection Service

Rate me:
Please Sign up or sign in to vote.
4.89/5 (4 votes)
2 Apr 2023CPOL7 min read 9.3K   65   5  
Using a collection to manage caches instead of implementing discrete cache instances
The point of this implementation is that 1) I need several caches to manage objects of different types and I want type safety and I don't want numerous discrete instances but rather a container for all caches. 2) The caches will not be large. 3) The caches should exist throughout the lifetime of the application unless explicitly cleared. 4) There is no need for eviction/removal policies because these policies cannot be determined by the application. 5) The keyed cache collection and the caches they manage must be thread safe.

Views

Daily Counts

Downloads

Weekly Counts

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect Interacx
United States United States
Blog: https://marcclifton.wordpress.com/
Home Page: http://www.marcclifton.com
Research: http://www.higherorderprogramming.com/
GitHub: https://github.com/cliftonm

All my life I have been passionate about architecture / software design, as this is the cornerstone to a maintainable and extensible application. As such, I have enjoyed exploring some crazy ideas and discovering that they are not so crazy after all. I also love writing about my ideas and seeing the community response. As a consultant, I've enjoyed working in a wide range of industries such as aerospace, boatyard management, remote sensing, emergency services / data management, and casino operations. I've done a variety of pro-bono work non-profit organizations related to nature conservancy, drug recovery and women's health.

Comments and Discussions