SQL Feeds - All your SQL feeds in one place.

Sponsors

Thursday, March 19, 2009

Microsoft Velocity

by David L. Penton via The Penton-izer on 3/19/2009 1:23:43 PM

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!


Posted to General Programming and tagged as velocity

Similar Posts

  1. Regex Precompilation in Practice
  2. Introduction to SQL Profiler
  3. Rate Mix Math Problem - An SQL Solution

email it!bookmark it!digg it!

Original Post: Microsoft Velocity

Legal Note

The content of the postings is owned by the respective author. SQL Feeds is not responsible for the contents of the postings. This site is automatically generated and cannot be reviewed for abusive content. If you find abusive content on SQL Feeds, please contact us. Designated trademarks and brands are the property of their respective owners. All rights reserved.

Advertise with us