StackExchange / StackExchange/StackExchange.Redis
Client Side Caching Support
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 6.2k
- Forks
- 1.6k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 43
Description
Hi guys,
First off, thank you - thanks a tonne of the RESP3 changes. It was really helpful, as a result of this, I will extend NRedisStack's RESP3 support soon.
We've been thinking a lot about client side caching, and have started that work in a few client libraries. I wanted to take a stab at doing this in StackExchange.Redis, and thought about the following breakdown.
-
Add support for the redis commands by modifying
src/StackExchange.Redis/Interfaces/IDatabase.cs:
a. CLIENT.TRACKING
b. CLIENT.TRACKINGINFO
c. CLIENT CACHING -
Extend the connection multiplexer to support a "light weight cache" doing something similar to:
var conn = ConnectionMultiplexer.Connect("localhost:6379,protocol=3,caching=1");
and:
var config = new ConfigurationOptions
{
// ...
Caching = 1,
// ...
};
using var conn = ConnectionMultiplexer.Connect(config);
-
Creating a cache object using something like MemoryCache, or anything you might suggest!
-
Process cache deletions and removals by handling the push notifications redis sends out as per that document above link
When RESP3 is used instead, invalidation messages are sent (either in the same connection, or in the secondary connection when redirection is used) as push messages (read the RESP3 specification for more information). -
Enable cache configuration by via the ConfigurationOptions in
src/StackExchange.Redis/ConfigurationOptions.cs
a. This includes optional support for whitelisting and blacklisting commands
b. Allowing users to specify memory use, etc (@uglide, feel free to add more context)
What are your thoughts? Is there something I'm missing, or should consider? Do you have plans that perhaps I can join in on?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/StackExchange.Redis/Interfaces/IDatabase.cs and src/StackExchange.Redis/ConfigurationOptions.cs, then read the linked Redis client-side caching and RESP3 documentation. Trace how the connection multiplexer handles configuration and RESP3 push messages. Done requires an agreed design covering the commands, cache configuration and storage, and invalidation handling described in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, redis
- Domain
- backend, databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100