Hi NagaRaju
In my opinion it would be good practice to move your logic off your console application and into a separate class library that can be accessed by both the console and web apps.
I use something along the lines of the code below in my repositories to cache static data. The repositories are in their own class library and can be used by a web app, console app, windows app, etc. In the example below I'm using the classes from the System.Runtime.Caching library...
public class CacheManager
{
public static object GetCachedItem(string key)
{
return MemoryCache.Default[key];
}
public static void AddItem(string key, object item)
{
var expiration = int.Parse(ConfigurationManager.AppSettings[key]);
var policy = new CacheItemPolicy
{
Priority = CacheItemPriority.NotRemovable,
AbsoluteExpiration = DateTimeOffset.Now.AddHours(expiration)
};
MemoryCache.Default.Set(key, item, policy);
}
}
Hope this helps