Thursday, March 27, 2008

Monorail Custom Session Factory for Memcached


I have written a simple but effective ICustomSessionFactory implementation that uses memcached storage on the back-end. If you don't know why you should be using memcached then you should check it out first. If you want to check out the code now, then go here. So far I think I have a passable Session Factory implementation that uses memcached on the back end. In later posts I will give some code examples and more details about deploying the Factory code.


Here are a few dependencies you will need to get going:

  • Castle::Monorail
  • A memcached server or servers running on your network. Memcached is a simple and fast distributed object server for balancing object caches across many servers!
  • The latest release of Enyim. These are the guys that did all the real client work! Thanks to them for a great memcached client!
  • If you want to run the tests or plan on making modifications then you will need the Nunit/RhinoMocks stack.

Current Features

  • A session dictionary that uses memcachedon the backend. This is the real meat and potatoes.
  • Almost complete IDictionary implementation (The Values property and enumeration are not implemented). The default session in monorail doesn't seem to support the values property either. For that reason and for performance reasons I have no plans to implement the values property.
  • ICustomSessionFactory for CASTLE::MONORAIL

Planned/Missing Features

  • Optional DB persistence of sessions using activerecord/memcached fusion. Memcached storage isn't redundant and as a rule caches should be considered unreliable. I would like to give developers the option of turning on a DB persistence layer to ensure the reliability of the session state.
  • Cache provider for monorail. Abiity to easily add memcached caching into all of your service components.
  • Cache provider integration with ActiveRecord.


Other Memcached Goodies

I also intend to write a custom cache provider for ActiveRecord / Monorail. So stay tuned!


unknown said...

I am like your blog thank for sharing it's informative to me. I am sharing the our best family DR experience is dentist in karachi best in the teeth caring.

Anonymous said...

The Billionaire fashion mogul who owns high-street brands such as Evans, Topshop and Topman, Wallis, Burton and Miss Selfridge gained 다 파벳 우회 주소 awhopping £2 million in December 2004 at a London casino. Before the 12 months ended, he gained another £1 million at roulette. Here’s extra details about how the roulette wheel was invented and how they’re made right now. Piece of equipment used to find out} the winning quantity and color.