In order to use StackExchange.Redis.Extensions you need to use two packages:
- The
corepackage; - The
serializerpackage;
Optionally you can also add:
- A
compressionpackage (to reduce memory and bandwidth usage);
The core package is the library that includes all the methods you need in your code, like AddAsync, ExistsAsync and so on. It carries StackExchange.Redis and you can access it using the IRedisDatabase interface injected via dependency injection.
This package includes the class responsible for serializing the objects you want to store in Redis. In order to prevent conflicts between StackExchange.Redis serialization and what you are using in your application, there are different options:
- Newtonsoft Json.NET
- System.Text.Json
- MsgPack
- Protobuf-net
- UTF8Json
- MemoryPack
- ServiceStack
You can optionally add a compression package to transparently compress data before storing it in Redis. Available compressors:
- GZip (no external dependencies)
- Brotli (no external dependencies)
- LZ4
- Snappier
- ZstdSharp
See the Compression page for setup instructions and recommendations.