0

I am putting together a reporting service based on a very slow connection to a backing (dare I say legacy) data store. The only access I have to the data store is via a web services SDK written in java.

I have a MVC3 C# front end using Ninject for the DI. The list of pre-canned reports and the prompts for parameters are unlikely to change frequently. There are some prompts that I need better control over for both freshness and security (the user list).

I have done a proof of concept using the System.Web.Caching.Cache but it does not offer the control I need over the data in the cache. I would like to use the MS Enterprise Application Caching Block because it does offer the control. I do not want to add Unity to the application (period, 'nuff said).

Has anybody used Ninject to resolve the ICacheManager / CacheManager?

tereško
  • 58,060
  • 25
  • 98
  • 150
THBBFT
  • 1,161
  • 1
  • 13
  • 29
  • What exactly is the problem and what have you tried yourself? – Steven Dec 11 '12 at 19:01
  • @Steven - I'm winding my way through the various constructor binding elements and have come up against the instrumentation provider (more precisely the ICachingInstrumentationProvider). I do not feel that I need instrumentation at this point, but there doesn't seem to be a way around this. – THBBFT Dec 11 '12 at 19:47
  • Isn't the Caching Block now part of System.Runtime.Caching anyway? – Isaac Abraham Dec 12 '12 at 21:02

1 Answers1

1

Seems I was making this way (way, way) more complicated then it needed to be.

Instructions to implement the Application Block Caching without Unity and without Instrumentation.

Add the following to your config file:

<section name="cachingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Caching.Configuration.CacheManagerSettings, Microsoft.Practices.EnterpriseLibrary.Caching" requirePermission="true" />
...
<cachingConfiguration defaultCacheManager="Default">
  <cacheManagers>
    <add name="Default" expirationPollFrequencyInSeconds="60" maximumElementsInCacheBeforeScavenging="10000" numberToRemoveWhenScavenging="100" backingStoreName="NullBackingStore" type="Microsoft.Practices.EnterpriseLibrary.Caching.CacheManager, Microsoft.Practices.EnterpriseLibrary.Caching" />
  </cacheManagers>
  <backingStores>
    <add type="Microsoft.Practices.EnterpriseLibrary.Caching.BackingStoreImplementations.NullBackingStore, Microsoft.Practices.EnterpriseLibrary.Caching" name="NullBackingStore" />
  </backingStores>
</cachingConfiguration>

Where you need the cache declare:

ICacheManager _cache = CacheFactory.GetCachemanager();

You can then use the full width and depth of the caching block.

THBBFT
  • 1,161
  • 1
  • 13
  • 29