0

We use a in-proc .net memory cache in all our biztalk applications, now if we all of a sudden need to invalidate the cache the only option we have is to restart the host instance.

Are there other options to invalidate the inproc .net cache without restarting the host instances?

nen
  • 621
  • 2
  • 10
  • 26

5 Answers5

1

I do not think there is any other option. I assume you are already using cache expiry time. If not use that. Even with cache expiry, it will expire only after some fixed time. If you often have this need to refresh cache instantly then either not to use Cache or look at SqlDependency .net class to receive an event in yr app when data is changed. You can look for SqlDependency details on msdn

Vikas Bhardwaj
  • 1,455
  • 8
  • 10
1

Well sure, but it would have to be something you implement yourself. Remember, you can program anything you want.

Assuming you're using a static class, it can implement a registry watcher (example: http://www.codeproject.com/Articles/4502/RegistryMonitor-a-NET-wrapper-class-for-RegNotifyC) to receive notifications. Then have a little tool that sets the flag. When the flag is set, the cache flushes.

Johns-305
  • 10,908
  • 12
  • 21
0

By default the host configuration refresh interval is 60 seconds. So either you can wait for 60 sec to get the cache auto refreshed or you can restart the host instance.

gguata
  • 1
0

What kind of cache are you using, and what would be the invalidation reason? I mean, how do you know (or how would the application know) when it is time to invalidate the cache?

Right now, you seem to be doing it manually, in which case, I could think of you having an endpoint in your application that is processed by the same host instance where you add your cache invalidation code.

tomasr
  • 13,683
  • 3
  • 38
  • 30
0

I actually did the same thing. Just expose a WCF endpoint from whatever app is hosting the cache and write a method that updates the objects in the cache - not sure what the use case is but want to be careful about concurrency and locks unless you are returning copies of the objects to the biztalk apps that use the cache then you'd be fine.

Then write a webform or something that calls the method via WCF. My cache lives on the BT app tier so i was able to used namedpipes for highest throughput but do some research for your use case.

Adam
  • 19
  • 2