Create named classes for cache objects

This makes heampdump and coredump analysis dramatically easier as cached entries will appear in the respective tools as `MemoryCacheSegement` and `MemoryCacheEntry` rather than generic objects. This allows for much simpler analysis of the memory impact of the cache as a whole.
should this be wrapped in a try to prevent issues with circular references?