views:

156

answers:

1

Setup WCF Service running in IIS 6 Caching - Enterprise.Caching

There's a business need to hold on to a message for a x amount of time(cache).

Another process will remove it from the cache. We may receive another message that will remove this message from the cache and prevent it from processing.

One way that I though of doing this is

  1. Receive message1 and put in cache for (x) minutes
  2. Start a new thread that expires in (x - 1) minutes
  3. Receive second message that affects first - removes first message from cache
  4. Thread expires if message1 still exist forward to datastore

Any suggestion would be greatly appreciated.

A: 

I'd probably spawn a dedicated thread that checked every N seconds to see if any messages are ready to be moved out of the cache.

One important thing about caching WCF Message objects -- make sure you're creating a buffered copy of each Message before you store it (use Message.CreateBufferedCopy). With some transports, the WCF message will actually point to the network stream, and the network will be blocked until the message is read.

alexdej