Enyim Memcached client - issues when using MemcachedSessionProvider

1.1k views Asked by At

We've had issues using Memcached as the session provider for an MVC .NET application.

The problem is that objects are going in to session, but then are being expired immediately, so we are unable to retrieve them.

The config we are using is as follows:

 <enyim.com>
    <memcached protocol="Binary">
      <servers>
        <add address="127.0.0.1" port="11211" />
      </servers>
    </memcached>
  </enyim.com>

  <cacheProvider defaultProvider="MemcachedCacheProvider">
    <providers>
      <add name="MemcachedCacheProvider"
          type="MemcachedProviders.Cache.MemcachedCacheProvider, MemcachedProviders"  defaultExpireTime="20000"/>
    </providers>
  </cacheProvider>   
1

There are 1 answers

0
soupy1976 On BEST ANSWER

We found the answer in a similar post, related to storing using enyim for caching and setting an expiry - makes sense given that the expiry would obviously be set for session items going into memcached.

The problems was the version of memcached we were using on Windows. It seems older version have problems with the server datetime.

When we connected to the memcached server via telnet, and ran the stats command, we found that the time property on the server (an epoch date) was set to some date in 1974.

After some investigation I found this post which confirms that it is down to the old Windows version of Memcached that we were using.

updating to the following version of memcached has solved this issue: http://blog.elijaa.org/index.php?post/2010/08/25/Memcached-1.4.5-for-Windows