Why String key in Caching?

Topics: Caching Application Block
Jul 14, 2009 at 2:12 AM

I was wondering if anyone could explain the reasons for typing the keys as String rather than Object in the Caching block? That seems like a rather unnecessary limitation...?

Jul 14, 2009 at 5:31 AM

Because the ASP.NET cache uses strings as cache keys? Because they're guaranteed serializable? Because they're relatively simple and hash well without having to do any work?

I don't know the exact reason (the original designers of the caching block are long gone from the project) but I suspect it's a combination of all of these, and that using arbitrary objects opens a HUGE can of worms with little actual gain in functionality.