Storing Null value in asp.net cache
This question is somehow related to one that I found here. In order to avoid round trip to the database I am caching the database output but in case of a null value, asp.net cannot make the difference between a value not set and an actual NULL val开发者_JAVA百科ue. I was wondering if instead of checking for the cache value for a specified key , we could check if a key is in the cache . Maybe there is a way to get what keys are in the cache instead of looking for values. If not I would like to know how you would typically cache such data or if in fact caching it makes no sense. Thank you.
I suggest you access the cache through your own wrapper function that converts a null
into a DBNull.Value
before storing.
精彩评论