# Cache Implementation in .NET 4.8

```csharp
if (Cache["total_"+ userId] == null)
{
    /* 30 minutes cache*/
    Cache.Insert("total_" + userId
        , dc.Customers.Where(p => p.UserId == userId).Count()
        , null, DateTime.Now.AddMinutes(30), TimeSpan.Zero);
}
total = (int) Cache["total_" + userId];
```

Reference :

[https://learn.microsoft.com/en-us/dotnet/api/system.web.caching.cache.insert?view=netframework-4.8.1](https://learn.microsoft.com/en-us/dotnet/api/system.web.caching.cache.insert?view=netframework-4.8.1)
