In an application I use several times a code like
var cliente = db.Clientes.Find(id);
So I created a controller that returns me:
[OutputCache(Duration = (10 * 60 * 60), VaryByParam = "id")]
public static Cliente ClienteInfo(int id)
{
using (WMBContext db = new WMBContext())
{
return db.Clientes.Find(id);
}
}
It has been extremely fast, however I am writing the entire model cached, imagining that different ids will be around 300, so they will be 300 x Model in memory in IIS. I remember that it was not advisable to store whole RecordSets in Session, in theory I'm not doing this?
Now I do not know what's best, fetching 6000x in the database or storing 300model in memory.
Is there a way to check the memory used in the cache? will it be linked to the pool? (the code is not yet in production)
Edit OBS: This model has relationships with other models and has more than 30 properties.