✨ Support switching from JSON to MessagePack in cache during runtime
This commit is contained in:
@@ -12,10 +12,16 @@
|
|||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
"App": "Host=localhost;Port=5432;Database=dyson_develop;Username=postgres;Password=postgres;Include Error Detail=True;Maximum Pool Size=20;Connection Idle Lifetime=60"
|
"App": "Host=localhost;Port=5432;Database=dyson_develop;Username=postgres;Password=postgres;Include Error Detail=True;Maximum Pool Size=20;Connection Idle Lifetime=60"
|
||||||
},
|
},
|
||||||
"KnownProxies": ["127.0.0.1", "::1"],
|
"KnownProxies": [
|
||||||
|
"127.0.0.1",
|
||||||
|
"::1"
|
||||||
|
],
|
||||||
"Swagger": {
|
"Swagger": {
|
||||||
"PublicBasePath": "/develop"
|
"PublicBasePath": "/develop"
|
||||||
},
|
},
|
||||||
|
"Cache": {
|
||||||
|
"Serializer": "MessagePack"
|
||||||
|
},
|
||||||
"Etcd": {
|
"Etcd": {
|
||||||
"Insecure": true
|
"Insecure": true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,6 +111,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"Cache": {
|
||||||
|
"Serializer": "MessagePack"
|
||||||
|
},
|
||||||
"KnownProxies": [
|
"KnownProxies": [
|
||||||
"127.0.0.1",
|
"127.0.0.1",
|
||||||
"::1"
|
"::1"
|
||||||
|
|||||||
@@ -5,6 +5,9 @@
|
|||||||
"Microsoft.AspNetCore": "Warning"
|
"Microsoft.AspNetCore": "Warning"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"Cache": {
|
||||||
|
"Serializer": "MessagePack"
|
||||||
|
},
|
||||||
"AllowedHosts": "*",
|
"AllowedHosts": "*",
|
||||||
"SiteUrl": "http://localhost:3000",
|
"SiteUrl": "http://localhost:3000",
|
||||||
"Client": {
|
"Client": {
|
||||||
|
|||||||
@@ -19,6 +19,9 @@
|
|||||||
"Etcd": {
|
"Etcd": {
|
||||||
"Insecure": true
|
"Insecure": true
|
||||||
},
|
},
|
||||||
|
"Cache": {
|
||||||
|
"Serializer": "MessagePack"
|
||||||
|
},
|
||||||
"Thinking": {
|
"Thinking": {
|
||||||
"DefaultService": "deepseek-chat",
|
"DefaultService": "deepseek-chat",
|
||||||
"Services": {
|
"Services": {
|
||||||
|
|||||||
@@ -15,7 +15,10 @@
|
|||||||
"Authentication": {
|
"Authentication": {
|
||||||
"Schemes": {
|
"Schemes": {
|
||||||
"Bearer": {
|
"Bearer": {
|
||||||
"ValidAudiences": ["http://localhost:5071", "https://localhost:7099"],
|
"ValidAudiences": [
|
||||||
|
"http://localhost:5071",
|
||||||
|
"https://localhost:7099"
|
||||||
|
],
|
||||||
"ValidIssuer": "solar-network"
|
"ValidIssuer": "solar-network"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -59,6 +62,9 @@
|
|||||||
"DiscoveryEndpoint": "YOUR_MICROSOFT_DISCOVERY_ENDPOINT"
|
"DiscoveryEndpoint": "YOUR_MICROSOFT_DISCOVERY_ENDPOINT"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"Cache": {
|
||||||
|
"Serializer": "MessagePack"
|
||||||
|
},
|
||||||
"Payment": {
|
"Payment": {
|
||||||
"Auth": {
|
"Auth": {
|
||||||
"Afdian": "<token here>"
|
"Afdian": "<token here>"
|
||||||
@@ -71,5 +77,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"KnownProxies": ["127.0.0.1", "::1"]
|
"KnownProxies": [
|
||||||
|
"127.0.0.1",
|
||||||
|
"::1"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,11 +36,17 @@
|
|||||||
"GeoIp": {
|
"GeoIp": {
|
||||||
"DatabasePath": "./Keys/GeoLite2-City.mmdb"
|
"DatabasePath": "./Keys/GeoLite2-City.mmdb"
|
||||||
},
|
},
|
||||||
"KnownProxies": ["127.0.0.1", "::1"],
|
"KnownProxies": [
|
||||||
|
"127.0.0.1",
|
||||||
|
"::1"
|
||||||
|
],
|
||||||
"Service": {
|
"Service": {
|
||||||
"Name": "DysonNetwork.Ring",
|
"Name": "DysonNetwork.Ring",
|
||||||
"Url": "https://localhost:7259"
|
"Url": "https://localhost:7259"
|
||||||
},
|
},
|
||||||
|
"Cache": {
|
||||||
|
"Serializer": "MessagePack"
|
||||||
|
},
|
||||||
"Etcd": {
|
"Etcd": {
|
||||||
"Insecure": true
|
"Insecure": true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,10 +53,7 @@ public static class Extensions
|
|||||||
builder.Services.AddSingleton<IClock>(SystemClock.Instance);
|
builder.Services.AddSingleton<IClock>(SystemClock.Instance);
|
||||||
|
|
||||||
builder.AddNatsClient("queue");
|
builder.AddNatsClient("queue");
|
||||||
builder.AddRedisClient("cache", configureOptions: opts =>
|
builder.AddRedisClient("cache", configureOptions: opts => { opts.AbortOnConnectFail = false; });
|
||||||
{
|
|
||||||
opts.AbortOnConnectFail = false;
|
|
||||||
});
|
|
||||||
|
|
||||||
// Setup cache service
|
// Setup cache service
|
||||||
builder.Services.AddStackExchangeRedisCache(options =>
|
builder.Services.AddStackExchangeRedisCache(options =>
|
||||||
@@ -70,6 +67,9 @@ public static class Extensions
|
|||||||
return RedLockFactory.Create(new List<RedLockMultiplexer> { new(mux) });
|
return RedLockFactory.Create(new List<RedLockMultiplexer> { new(mux) });
|
||||||
});
|
});
|
||||||
builder.Services.AddSingleton<ICacheService, CacheServiceRedis>();
|
builder.Services.AddSingleton<ICacheService, CacheServiceRedis>();
|
||||||
|
if (builder.Configuration.GetSection("Cache")["Serializer"] == "MessagePack")
|
||||||
|
builder.Services.AddSingleton<ICacheSerializer, MessagePackCacheSerializer>();
|
||||||
|
else
|
||||||
builder.Services.AddSingleton<ICacheSerializer, JsonCacheSerializer>();
|
builder.Services.AddSingleton<ICacheSerializer, JsonCacheSerializer>();
|
||||||
|
|
||||||
return builder;
|
return builder;
|
||||||
|
|||||||
@@ -34,6 +34,9 @@
|
|||||||
"Etcd": {
|
"Etcd": {
|
||||||
"Insecure": true
|
"Insecure": true
|
||||||
},
|
},
|
||||||
|
"Cache": {
|
||||||
|
"Serializer": "MessagePack"
|
||||||
|
},
|
||||||
"Service": {
|
"Service": {
|
||||||
"Name": "DysonNetwork.Sphere",
|
"Name": "DysonNetwork.Sphere",
|
||||||
"Url": "https://localhost:7099"
|
"Url": "https://localhost:7099"
|
||||||
|
|||||||
@@ -10,10 +10,16 @@
|
|||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
"App": "Host=localhost;Port=5432;Database=dyson_zone;Username=postgres;Password=postgres;Include Error Detail=True;Maximum Pool Size=20;Connection Idle Lifetime=60"
|
"App": "Host=localhost;Port=5432;Database=dyson_zone;Username=postgres;Password=postgres;Include Error Detail=True;Maximum Pool Size=20;Connection Idle Lifetime=60"
|
||||||
},
|
},
|
||||||
"KnownProxies": ["127.0.0.1", "::1"],
|
"KnownProxies": [
|
||||||
|
"127.0.0.1",
|
||||||
|
"::1"
|
||||||
|
],
|
||||||
"Swagger": {
|
"Swagger": {
|
||||||
"PublicBasePath": "/zone"
|
"PublicBasePath": "/zone"
|
||||||
},
|
},
|
||||||
|
"Cache": {
|
||||||
|
"Serializer": "MessagePack"
|
||||||
|
},
|
||||||
"Sites": {
|
"Sites": {
|
||||||
"BasePath": "SiteData"
|
"BasePath": "SiteData"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user