Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
166 views
in Technique[技术] by (71.8m points)

Azure redis cluster key event invalidation events

I have set up Azure Redis cache service with 2 clusters. I am using StackExchange.Redis to communicate with the cache. I am using SSL based connection string to connect as suggested in Azure portal.

Issue:
I have multiple instances of my service which connects to Redis. When I delete the key from one node, I want that to be captured in other instances of my service (for local in-memory cache invalidation). However, I am noticing that not all of my service instances receive key delete events. I do get Pub/Sub events across all instances but it seems that Keyspace notifications are not being delivered through all Redis clusters. I have tried this with __keyevent@0:__:del for my test purposes where I notice that issue.

Intializing my ConnectionMultiplexer as follows:

ConnectionMultiplexer.Connect(connectionString)

I have poked through https://github.com/redis/redis/issues/2541 and figured that Keyspace notifications are not delivered across clusters, according to issue - resolution is to connect clients with all masters, which in my case, Redis set up through Azure and not so clear on how to specify all master nodes (address).

Any help would be appreciated. Thanks in advance.

UPDATE: Nuget for redis client: StackExchange.Redis.StrongName 1.2.6


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

There is an open PR to add support for cluster keyspace notifications. A workaround would be to use redis pub/sub to handle key invalidation yourself...you just wouldn't get the natural redis TTL support for a key expiring.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...