Just another tech site

ASP.NET Cache


Introduction

Todo

Some code

Insert in cache

todo

Cache visualisation

        public string CacheSnapshot()
        {
            StringBuilder sb = new StringBuilder();
            if (Cache != null)
            {
                sb.AppendLine(String.Format("EffectivePercentagePhysicalMemoryLimit [{0}] ", Cache.EffectivePercentagePhysicalMemoryLimit));
                sb.AppendLine(String.Format("EffectivePrivateBytesLimit [{0}] ", Cache.EffectivePrivateBytesLimit));
                sb.AppendLine(String.Format("Count [{0}] ", Cache.Count));
                
                IDictionaryEnumerator CacheEnum = Cache.GetEnumerator();
                while (CacheEnum.MoveNext())
                {
                    if (CacheEnum.Current.GetType() == Type.GetType("System.Collections.DictionaryEntry"))
                    {
                        DictionaryEntry de = (DictionaryEntry) CacheEnum.Current;
                        sb.AppendLine(String.Format("[{0}] [{1}] ", de.Key, de.Value));
                    }
                }
               
            }
            else
            {
                sb.AppendLine("Cache NULL");
            }
            return sb.ToString();
        }

Reference

[1]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Tag Cloud

%d bloggers like this: