In this Blog Post we are going to see how we can use this API in .NET Applications.
Here I am going create my own CacheLib class with the following Add, Get, Remove methods as shown above.
First Let me create a C# class file called CacheLib.cs in which I am going to implement all the CURD methods for the Cache object. to do let us create ObjectCache Cache = MemoryCache.Default . (Memory Cache) Then we Add Get, Add, Remove Methods.
Add any object to Cache:
Here I am created the Generic Add method.
Get or Retrieve Cached Item from Cache Object: Generic get method
Remove or Delete from Cache:
User Defined class to store in Cache.
the following Code snippet shows how to add and retrieve data from Cache object .