How to use Tags in terms of memory consumption

Answered How to use Tags in terms of memory consumption

  • Sunday, June 15, 2008 9:28 AM
     
     

    Hello, I've got a quick question regarding how the Tags are stored within a cache. Let's say there are lots of cached objects tagged the same way like "Men", "Shoes", "Sandals" (actually are categories). I've noticed that Tags are strings so wouldn't it better to use something like category ID (integer value) as Tags instead of the whole text keeping them as short as possible to minimize used memory or Tags are actually stored as a single dictionary with references to it and the example I've mentioned above doesn't consume much memory on Tags?

    Thanks!

All Replies

  • Monday, June 16, 2008 7:21 PM
    Moderator
     
     Answered

     

    Good point - currently we only maintain them as strings and since the strings are interned the overhead is maintaining the array of pointers. Internally we have a reverse index which only maintains them once - however we need to keep track of the tags just to return them if you need the whole cache item or to delete them from the index.  However, we will definitely consider the enumeration approach as well.