1
votes
  1. Redis is running on windows (services -> Redis Server)
  2. Web.config is configured
<caching>
 <outputCache defaultProvider="MyRedisOutputCache" enableOutputCache="true" enableFragmentCache="true" sendCacheControlHeader="true">
    <providers>
      <add name="MyRedisOutputCache" type="microsoft.web.redis.redisoutputcacheprovider" host="127.0.0.1" port="6379"accesskey="" ssl="false" />
    </providers>
  </outputCache>
</caching>
  1. Output cache attribute is added to my Web Api controller

    [CacheOutput(ClientTimeSpan = 60, ServerTimeSpan = 60)]

  2. Caching is working, but Redis does not contain any key

    redis 127.0.0.1:6379> keys * (empty list or set) redis 127.0.0.1:6379>

  3. Also tried to register my custom output cache provider

    public override string GetOutputCacheProviderName(HttpContext context) { return "MyRedisOutputCache"; }

Nothing helped :( Any idea?

1
I also have the same issue, if I run redis-cli monitor I only see bunch of GET requests but no SET at all. Strange! the same provider works just fine with a remote redis (eg. redislab), and the same redis installation is working great with other parts of the same application that uses StackExchange Redis client to store and retrieve data. - undefined

1 Answers

0
votes

I finally was able to solve the problem by uninstalling an existing redis installation which became obsolete https://github.com/rgl/redis

If you installed redis from there, then read along...

I then installed redis-64 from https://chocolatey.org/packages/redis-64 and it worked perfectly.

  • Once installed via chocolatey, goto C:\ProgramData\chocolatey\lib\redis-64 on an administrative command prompt or powershell and run the following command to register redis as windows service

    redis-server --service-install redis.windows-service.conf --loglevel verbose

  • then create a folder Logs (without this the service won't start)

  • run the service redis-server --service-start