DCSIMG
Velocity Cache Notifications - Gil Fink's Blog

Gil Fink's Blog

Fink about IT

News

Microsoft MVP

My Facebook Profile My Twitter Profile My Linkedin Profile

Locations of visitors to this page

Creative Commons License

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.
© Copyright 2012 Gil Fink

Hebrew Articles

Index Pages

My OSS Projects

English Articles

Velocity Cache Notifications

Velocity Cache Notifications

I’ve been asked by a friend how to Using Velocity Cache Notifications
use cache notifications in Velocity.
if you don’t know, Velocity,
Microsoft distributed cache, offers a
cache notification mechanism that can
help you to get notified when cache operations occur.
This post will help you to get started with Velocity cache notifications.

Cache Notifications

As written earlier, Velocity has a cache notifications feature. That feature
enables us to get notified when cache operations occur in our cache cluster.
What happens when this feature is enabled is that we get asynchronous
cache notifications
for many aspects of the cluster including the cache,
region and cached item operations.
The following are the notifications that we can receive:

  • Create/Clear/Remove regions.
  • Add/Replace/Remove cached items.

The following notifications can be added:

  • Cache level callback – get notified on all the operations that
    occur on all the items and regions in a specific cache.
  • Region level callback – get notified on all the operation that
    occur on all the items and region of a specific region.
  • Item level callback – get notified on all the operations that
    occur to a specific item. 

For more details go to the following MSDN post – Cache Notifications (Velocity).

How to Enable Cache Notifications?

In order to enable server cache notifications (which is disabled by default)
we need to configure the relevant named cache. There are two
PowerShell commands that enables us to do that thing which are
New-Cache and Set-CacheConfig.
They get as parameter NotificationEnabled which enable the cache.
For example –

New-Cache –CacheName cache1 –NotificationsEnabled 

will create a new named cache with the name cache1 which has the
cache notifications enabled.

Summary

Lets sum up, Velocity is going to be shipped with cache notification mechanism.
That mechanism can help you to get notified whenever a cache operation
occurs. This mechanism can help to monitor the Velocity cluster or to know
when operation occurs in the cache. In the post I showed how to enable
cache notifications in a specific named cache. In the next post I’ll demonstrate
how to add cache notifications callbacks.


DotNetKicks Image

Comments

altso said:

Hi Gil,

NotificationEnabled switch should be in plural form:

New-Cache –CacheName cache1 –NotificationsEnabled

# December 25, 2009 10:52 PM

Gil Fink said:

Thanks altso.

Fixed my typing error.

# December 26, 2009 11:31 AM

Notes on AppFabric Beta 2 and Cache Notifications « Tales from a Trading Desk said:

Pingback from  Notes on AppFabric Beta 2 and Cache Notifications « Tales from a Trading Desk

# March 3, 2010 4:24 PM