tags:

views:

52

answers:

1

I have some code(client side) that is trying to cache responses from a web service. I save the responses in a System.Web.Caching.Cache object gotten from System.Web.HttpRuntime.

I make a call once, then i make it again and have a console output saying it loaded from cache. But I am never getting the console output. I ran it in a debugger and put a break point at the Get and the Cache as the entry and the key inside the cache is the same as the key I'm passing into the get but it still returns null?????

basically the code looks like this.


public object MakeRequest(string uri)
{
(break point)object retList = Querier.Cache.Get(uri);

            if (retList != null)
            {
                Console.WriteLine("Loaded from Cache");

            }
            retList = Querier.MakeRequest(uri);
            Querier.Chache[uri] = retList;
            return retList;
}

Querier is an object that makes my http request and deserializes the object then returns it.

Anyone have an idea about why the cache is returning null and not the object stored in it? this one has me at a loss because the debugger shows that both the internal key and the one I'm passing in are the same string(although not formed at the same place) Thanks in advance

A: 

So it turns out i didn't look quite close enough at the two strings and one was slightly diffrent fromt he other, they both went to the same webpage but weren't equal by string comparor method.

Jack
Please mark your question as answered.
ErikHeemskerk
it won't let me for another 23 hours for some reason
Jack