sharepointtimerhttpruntime.cache

Sharepoint Timer Job and access to the HTTPRuntime Cache object


I am planning to create a Sharepoint Timer Job and configure it to run on all of our farm web front end machines.

The timer job will read data from the SP SQL Server instance and hopefully update it into the HTTPRuntime cache object on the 2 Web FTEs that we have.

The question is this, will the Timer Job have access the ASP.net cache objects or will they not because they're running from owstimer.exe?

If not, what would be the best way of going about updating a cache item on the 2 web front ends? I should mention that we current DO NOT have the IIS sites configured to be acessed seperately. I.e. we have one URL to access the farm and our content switch does the deciding which machine gets it.

So is it even possible?


Solution

  • You cannot access the cache directly no. The time jobs are running in a different process than then the application pool your website is running on.

    You could do it indirectly though. A way I can think of would be to create a simple web service on your website that listens for your timer job and updates the cache on the website.

    Another option would be to look into memcached for .NET, a project that allows you to access the cache from other processes.