views:

38

answers:

2

If I have my cacheduration set to some value for my Web Service, is it possible to force the function to trigger?

Thanks.

A: 

The only way you could force it is to send a no-cache header to the server.

For information view the MSDN Documentation, specifically the remarks, quoted below.

In addition, HTTP indicates that a user agent (the browser or calling application) should be able to override server caching by setting the "Cache-Control" to "no-cache". ASP.NET applications, therefore, ignore cached results when they find a "no-cache" header.

Mitchel Sellers
A: 

Here's the pattern I typically use. If the item exists in the cache you use it otherwise you create it and store it in the cache:

Dim Obj = Cache("YourKeyHere")
Dim YourObj As DataSet
If Obj IsNot Nothing AndAlso TypeOf Obj Is DataSet Then
    YourObj = DirectCast(Obj, DataSet)
Else
    YourObj = New DataSet()
    '...do your normal loading of your object here
    Cache.Insert("YourKeyHere", YourObj)
End If

If instead you want to be notified when your cache expires you can use the onUpdateCallback

Chris Haas
Well i was thinking more from the client side. Say im returning a list of values to populated a dropdownbox. If the want to get the latest values, is there a way to just refire the function? Or do i have to write a whole new function.
Sean P