Info
Version: | 1.1.0 |
Author(s): | Fujiy |
Last Update: | Thursday, August 7, 2014 |
.NET Fiddle: | Create the first Fiddle |
Project Url: | http://blog.fujiy.net/ |
NuGet Url: | https://www.nuget.org/packages/Fujiy.Util |
Install
Install-Package Fujiy.Util
dotnet add package Fujiy.Util
paket add Fujiy.Util
Fujiy.Util Download (Unzip the "nupkg" after downloading)
Usually you do this(for ValueTypes, but Ref Types are similar):
decimal price;
var returnFromCache = Cache["CarClassGetPrice" + carId];
if(returnFromCache is decimal)
{
price = (decimal)returnFromCache;
}
else
{
price = GetPrice(carId);
Cache["CarClassGetPrice" + carId] = price;
}
With Fujiy.Util you just write:
decimal price = CacheHelper.FromCacheOrExecute(() => myObj.GetPrice(carId));.