mardi 24 février 2015

Mvc Application Cache

how can i build data cache for my Application with Repository Pattern? With lock object and persist for each session...



public sealed class NewsCache
{
List<int> _tagsIds = null;
static NewsCache _instance = new NewsCache();
private static readonly object LockObject = new object();
private readonly NewsManager _newsManager = new NewsManager();
public static NewsCache Instance
{
get
{
lock (LockObject)
{
if (_instance == null)
{
_instance = new NewsCache();
}
return _instance;
}

}
}

private NewsCache()
{

}
}

Aucun commentaire:

Enregistrer un commentaire