Microsoft Velocity

Microsoft has been working on a great venture: "Velocity".  I have a great interest in that, since over the past couple of years I have been looking at ways to make cache be more effective for applications.  I've started giving talks and demonstrations with Microsoft Velocity.  Here are some basics (from a console app perspective):

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Caching;

namespace Velocity1 {
    class Program {
        static void Main(string[] args) {
            string cacheName = "MyNewCacheName";
            var cacheFactory = new CacheFactory(
                new ServerEndPoint [] {
                    new ServerEndPoint("localhost", 22233, "DistributedCacheService")
                }
                , true
                , false
            );
           
            var cache = cacheFactory.GetCache(cacheName);
            var cacheKey = "MyCacheKey";
            var s = cache.Get(cacheKey) as string;
           
            if( s == null )
            {
                s = "This is my data: " + DateTime.Now.ToString();
                Console.WriteLine("Cache Miss");
                cache.Put(null
                    , cacheKey, s
                    , null
                    , null as CacheItemVersion
                    , new TimeSpan(0, 0, 15)
                    );
            }
            else
            {
                Console.WriteLine("Cache Hit");
            }
       
            Console.WriteLine( s );
            Console.ReadLine();
        }
    }
}

Also, I have some videos for Installation & Configuration and live code samples.  Enjoy!

3 Comments

  1. Kevin Clark Says:

    Thanksyou David for this good resource, however i must say that Velocity is still in its infancy and requires quite a bit of maturity before it can actually be considered for high performance, mission critical apps. Eventually when the CTP3 comes out, it would have to be thoroughly tested before deployment. The product would have to undergo some rigorous scrutiny before performance and reliability hungry applications can consider using it.

    All the best!

  2. David L. Penton Says:

    Kevin,

    Thanks for the comment. I completely understand what you are saying - and that is true for many applications - Microsoft Velocity is no exception. That is the wonderful thing about designing software with a Provider model - so that you can adjust and test vigorously for the kind of scenarios you are describing. Any first generation product deserves much scrutiny (one of the reasons I am interested in Velocity!)

    Thanks,

    David

  3. Eyal Vardi Says:

    Cool tool - Microsoft Distributed Cache (Velocity) Admin Tool mdcadmintool.codeplex.com


Leave a Reply