I found the way I have created a function as below
private static double GetTimeLeft()
{
//create a time stamp for tomorow 00:10 hours
var tomorrow0010Minute = DateTime.Now.AddDays(1).Date.AddMinutes(10);
return Math.Round((tomorrow0010Minute - DateTime.Now).TotalHours);
}
This gives me a double value which I used in my function as follow
public static Collection<CProductMakesProps> GetCachedSmartPhoneMake(HttpContext context)
{
var allMake = context.Cache["SmartPhoneMake"] as Collection<CProductMakesProps>;
if (allMake == null)
{
allMake = new CModelRestrictionLogic().GetTopMakes();
context.Cache.Insert("SmartPhoneMake", allMake, null,
DateTime.Now.AddHours(GetTimeLeft()),
Cache.NoSlidingExpiration);
}
return allMake;
}
And done :)