Skip to content

RedisDependencyManager doesn't handle redis not being available #1

@glav

Description

@glav

Using version 4.1.1 ,if the redis server isn't running or can't be connected to, the call to _redisDatabase.KeyExists() in RegisterParentDependencyDefinition() throws an exception.
My config is as follows:
It looks like the method: Get(string cacheKey, DateTime absoluteExpiryDate, Func getData, string parentKey = null, CacheDependencyAction actionForDependency = CacheDependencyAction.ClearDependentItems) handles the cache not being available when checking for the item, it's the code that tries to update the dependencies that doesn't.

After playing with this some more, I think there are two situations to consider:

  1. redis is not available when the application starts (or is recycled)
  2. redis is temporarily unavailable while the application is running

Event 2 is more likely to occur and I don't want it to make my app throw an exception. When reading, it should treat it as if it's not cached. An error when writing is trickier - perhaps only this web app can't connect, and others are fine? What if this is a dependency clear - other apps may still be able to get old data from redis.

Issue raised by @pdonovan on Bitbucket 2016-04-19 and migrated to Github

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions