locked
caching a value for Site RRS feed

  • Question

  • User968218215 posted

    Hi,

    I want to cache a string value for 15 mins for my website for all users so the site does not hit a function until the 15 mins are up.

    If strEuro_Buy = String.Empty Then
                strEuro_Buy = getPrices("EUR.buy")
            End If

    I have been looking on google and think that the below is close -

    HttpContext.Current.Cache.Insert("CacheKey", strEuro_Buy, Nothing, New TimeSpan(0, 15, 0), Cache.NoSlidingExpiration, CacheItemPriority.High, Nothing)

    Am I going in the right direction or should i be looking at sessions?  Im a little confused how this would work for all users to the site.

    Thanks for all help...

     

    Wednesday, May 15, 2013 7:53 AM

Answers

  • User-1360095595 posted

    If you want all users to see the same value then Cache is the correct thing to use. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, May 15, 2013 7:55 AM