-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
.NET has built in abstractions for caching. Namely IDistributedCache and in .NET 9 the new HybridCache.
Caching services like Redis add an implementation of the IDistributedCache interface making it easy to add Redis by adding a dependency on Microsoft.Extensions.Caching.StackExchangeRedis and adding the following code to the application startup.
builder.Services.AddStackExchangeRedisCache(options =>
{
options.Configuration = builder.Configuration["RedisConnectionString"];
options.InstanceName = "Orders";
});
This also makes it easy to switch out caching technologies, for example using an InMemory cache when working locally and Redis when running in production.
It would be great if Momento can add support, with syntax similar to:
builder.Services.AddMomentoCache(options =>
{
options.ApiKey = builder.Configuration["MomentoApiKey"];
options.CacheName = "Orders";
});
I have a working example of this, if you can let me know the best way to contribute my implementation I can raise a PR.
Metadata
Metadata
Assignees
Labels
No labels