Hi, even after a couple of years I still feel like a beginner on many subjects.
The services I’ve written use a set of data that is completely static but must be read preferably only once because reading it every time makes the call last 10 seconds longer. I thought of doing this by putting it all in a static class and passing it to the library calls each time I need it, something like:
public partial class CRMServices : Service
{
static CRMDataClassesC.GeneralDataClasses.CRMStaticData ST;
public object Get(CRMRequestTest request)
{
CRMLib crml;
crml = new CRMLib(.....)
{
CollOfCRMStaticData = ST
};
ST = crml.CollOfCRMStaticData;
/// DO STUFF
return new CRMResponseTest
{
/// return stuff
};
}
}
And while this works, as the first call to the endpoint caches the data, and that data is available to everyone, eventually the data (probably the cache) expires after some time…
What am I doing wrong, or is there a better way of doing things?
thanks for every helpful answer