Search code examples
authenticationcachingwindows-server-2008servicestack

ServiceStack Caching/Authentication with Windows Server


I have setup ServiceStack on my ASP.NET MVC 4 Project and all is working fine. (I am using ASP.NET MVC, Entity Framework 5, SQL SERVER 2008 and Windows Server 2008 R2 and AngularJS to call ServiceStack)

However, I wonder about authentication issue. I am using MemoryCacheClient() and my UserSession is very often lost and users need to reconnect.

I think it is a Cache configuration problem tha's why I read servicestack cache wiki here : https://github.com/ServiceStack/ServiceStack/wiki/Caching

My questions are simples : What are cache options for my environment (Windows) ? Is it really a cache problem ?

Thanks in advance


Solution

  • Windows Caching

    Redis and Memcached are both available for Windows but from a quite test the Redis binaries seem easier to use. You can download them from http://ruilopes.com/redis-setup/

    To configure ServiceStack to use redis have a look on the ServiceStack wiki page

    MemoryCacheClient

    I'm making the assumption you are running ServiceStack on IIS

    MemoryCacheClient uses a ConcurrentDictionary to store cache entries. This means it is stored in the AppPool memory which is cleared everytime the AppPool recycles. By default AppPool recycles everytime the Web.config or bin folder changes and every 1740 minutes.