Method cache

J

JerryY

I have a web service with two public methods foo and faa. Neither are
cached.
I also have an internal method called cacheIt. This one is setup to be
cached.

If both foo and faa make calls to cacheIt, will the method cacheIt be
cached? Or must both foo and faa be cached?

cacheIt has the data that I want to cache.

thanks
 
J

JerryY

Thanks you your quick reply.

by method cache I mean in the
[WebMethod(Description=@"Log successful retrieval of manifest for given
rivision.", CacheDuration=300)]
You can set the cache duration.
My understanding is that as long as the method parameters do not change
between calls, the "page" is cached.
 
J

JerryY

Yea I did the server side cache as a temp fix.
But that has it's own issues.
(appName is passed as a parameter)

DataSet ds = null;
Object obj = Context.Cache.Get(appName);
if (obj == null)
{
//if not present, create a new manifest for first time
ds = new DataSet();
ds.ReadXml(...);
Context.Cache.Insert(appName, ds);
}
else
{
ds = (DataSet) obj;
}
return ds;

If say I have 30 requests at the same time(first time service is started
up), the dataset is going to be created 30 times (because at that second when
30 requests are processed, the cache is empty) and the last one in is the one
that will be used in the cache. The 31st reqeust will use what is in the
cache.


--
Jerry


Patrice said:
Ah AFAIK it caches the XML response sent by the method to a client over
http...

Of course it won't have any effect if the method is not called throught a
webservice call but directly....

Remember also that you have server side caching available :
http://msdn2.microsoft.com/en-us/library/system.web.caching.cache.aspx

--
Patrice


JerryY said:
Thanks you your quick reply.

by method cache I mean in the
[WebMethod(Description=@"Log successful retrieval of manifest for given
rivision.", CacheDuration=300)]
You can set the cache duration.
My understanding is that as long as the method parameters do not change
between calls, the "page" is cached.


--
Jerry


Patrice said:
I'm not sure what you call a "cached method". Data are cached not
methods...

Both foo and faa will just get what cacheIt returned to them so if
cacheIt
returns cached data, both foo and faa (or any other method that would
call
cacheIt) will deal with what cacheIt returned that is cached data (anyway
they have no way to know what are the real data cached by cacheIt and no
way
to overcome this cache ???)...

You may want to elaborate a bit as the context is unclear, what do you
mean
by having "cacheIt setup to be cached" ? You perhaps talking about
something
else than what I thought...

--
Patrice

"JerryY" <[email protected]> a écrit dans le message de
(e-mail address removed)...
I have a web service with two public methods foo and faa. Neither are
cached.
I also have an internal method called cacheIt. This one is setup to be
cached.

If both foo and faa make calls to cacheIt, will the method cacheIt be
cached? Or must both foo and faa be cached?

cacheIt has the data that I want to cache.

thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,079
Latest member
ElidaWarin

Latest Threads

Top