Why can't I use the Microsoft.Orleans.Persistence.Memory library at all when following your official documentation?
Why can't I use the Microsoft.Orleans.Persistence.Memory library at all when following your official documentation?
The documentation you provided looks like this:
using Microsoft.Extensions.Hosting;
using Orleans.Configuration;
using Orleans.Hosting;
var builder = Host.CreateApplicationBuilder(args)
.UseOrleans(siloBuilder =>
{
siloBuilder
.UseLocalhostClustering()
// Configure Redis as grain storage
.AddRedisGrainStorage(
name: "redisStore",
configureOptions: options =>
{
options.ConnectionString = "localhost:6379";
options.Database = 0;
options.UseJson = true; // Serializes grain state as JSON
options.KeyPrefix = "grain-"; // Optional prefix for Redis keys
});
});
// Run the host
await builder.RunAsync();
This is the most basic example, but it can't even pass compilation. How exactly are we supposed to use this? Why can't even a simple HelloWorld program run properly? Has Microsoft become so incompetent now?
Microsoft's documentation used to be the best in the world. What's going on now? How can you not even get a simple HelloWorld documentation right?
Which documentation are you referring to, could you link to it? Your question asks about in-memory persistence but the code you included is for Redis.
This is the most basic knowledge, and I certainly wouldn't miss it. Your library can't even pass the most basic compilation. I'm using .NET Core 8.0.
If you provide more information, we may be able to assist you
Have you seen that it directly throws an error?
@TianMaiCheng where did you find this in documentation? I'd like to fix the corresponding documentation. This is not how Redis storage should be configured. Here is an example of how it should be configured:
hostBuilder.UseOrleans((ctx, siloBuilder) =>
{
siloBuilder
.AddRedisGrainStorage("redisStore", options =>
{
options.ConfigurationOptions = ConfigurationOptions.Parse(connectionString);
options.EntryExpiry = TimeSpan.FromHours(1);
})
.AddMemoryGrainStorage("MemoryStore");
});
The ConfigurationOptions property is where the Redis client options are configured. It has the type StackExchange.Redis.ConfigurationOptions.
Address is here: https://www.nuget.org/packages/Microsoft.Orleans.Persistence.Redis