This project is read-only.

How to Configure Web.config for Multiple Instances?

May 26, 2009 at 6:12 PM


First of all, congratulations. This cache solution is very easy to use while yet powerfull.


But I'm needing any help in this case:

I had used MemCacheD Manager to create 2 instances in the same server (the same IP with different ports).

The instance at 11211 port is named as "MySite.WebCache" and the instance at 11212 port is named as "MySite.ImagesCache".

Everything easy here.


But do is possible to configure Web.config to use these different instances in the same application?

And maybe, at code, with something like this:

var image = DistCache.Get<byte[]>("Image01", "MySite.ImagesCache");


Is there any way to perform this task?


Thanks in advance!



May 26, 2009 at 7:38 PM

Hi Eric,

This is not possible in the same application. Its upto memcached client to choose where to place data.
On way to acheive this is to have a separate application for Images. And use a handler to serve the image data like

<img src="./ImageData/Download.ashx?a=test.jpg" />

We use this approch to serve images from Database. Hope thats what ur looking for.



May 26, 2009 at 7:45 PM

Hi Fahad,

Thanks by the fast reply.

I'm going to use this approach as well. Really easy...




Jun 8, 2009 at 4:08 PM

Hi one more time...


I'm with another question about different instances configuration... What about SessionState?

I would like to configure other instance to be used for SessionState cache. Something like a "MySite.SessionCache" instance at 11213 port.

Do is possible to configure SessionState to use one instance and DistCache object to use other instance?

Thanks again!




Jun 8, 2009 at 6:13 PM


This is not possible right now.