Post

Object Cache Viewer Joins EPiServer Developer Tools

It’s super cool to work together with the community and unite effort across all areas to strengthen EPiServer ecosystem and toolsets.

After chat with Joe Mayberry we decided that his local object cache viewer would be great addition to EPiServer DeveloperTools.

Thanks to Joe’s contributions local object cache viewer is now part of EPiServer DeveloperTools package. During the merge we added small extra to the tool - you can now also see approx. size of the cache entry (might be sometimes useful to know who ate the cake).

cache-viewer

Code to calculate cache entry size is quite naïve, but seems to give good enough numbers:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
private static long GetObjectSize(object obj)
{
    if(obj == null)
        return 0;

    try
    {
        using (Stream s = new MemoryStream())
        {
            var formatter = new BinaryFormatter();
            formatter.Serialize(s, obj);

            return s.Length;
        }
    }
    catch (Exception)
    {
        return -1;
    }
}

There are also couple of other features that we need to add to cache viewer / manager, but those are coming :)

Cache viewer / manager will be available starting from v3.4

Happy caching!

[eof]

This post is licensed under CC BY 4.0 by the author.

Comments powered by Disqus.