Skip to content

Commit

Permalink
add hybrid cache
Browse files Browse the repository at this point in the history
  • Loading branch information
eric4ps committed Feb 17, 2025
1 parent 9f94936 commit 598a703
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ protected override void Up(MigrationBuilder migrationBuilder)
values: new object[] { 13, null, "portal", null, "Redis", "Redis", 1, "redis", "{\"Redis\":{\"ConnectionStrings\":null,\"SlidingExpirationInMinute\":10,\"AbsoluteExpirationInMinute\":null,\"AbsoluteExpirationRelativeToNowInMinute\":null}}", false });
migrationBuilder.InsertData("mix_global_setting",
columns: new[] { "id", "last_modified", "service_name", "section_name", "display_name", "description", "tenant_id", "system_name", "settings", "is_encrypt" },
values: new object[] { 14, null, "portal", null, "Mix Heart", "Mix Heart", 1, "mix_heart", "{\"CacheConnection\":null,\"IsCache\":true,\"CacheMode\":\"JSON\",\"databaseProvider\":\"SQLITE\",\"CacheFolder\":\"wwwroot/mixcontent/cache\"}", false });
values: new object[] { 14, null, "portal", null, "Mix Heart", "Mix Heart", 1, "mix_heart", "{\"CacheConnection\":null,\"IsCache\":true,\"CacheMode\":\"HYBRID\",\"CacheFolder\":\"wwwroot/mixcontent/cache\"}", false });
migrationBuilder.InsertData("mix_global_setting",
columns: new[] { "id", "last_modified", "service_name", "section_name", "display_name", "description", "tenant_id", "system_name", "settings", "is_encrypt" },
values: new object[] { 15, null, "portal", null, "Ocelot", "Ocelot", 1, "ocelot", "{\"Routes\":[{\"Priority\":0,\"DownstreamPathTemplate\":\"/{everything}\",\"DownstreamScheme\":\"https\",\"DownstreamHostAndPorts\":[{\"Host\":\"localhost\",\"Port\":5010}],\"UpstreamPathTemplate\":\"/{everything}\",\"UpstreamHttpMethod\":[\"Get\",\"Post\",\"Put\",\"Patch\",\"Delete\"],\"RateLimitOptions\":{\"ClientWhitelist\":[],\"EnableRateLimiting\":true,\"Period\":\"1s\",\"PeriodTimespan\":1,\"Limit\":1000},\"FileCacheOptions\":{\"TtlSeconds\":0,\"Region\":\"Portal_VN\"},\"HttpHandlerOptions\":{\"AllowAutoRedirect\":true,\"UseCookieContainer\":true,\"UseTracing\":true,\"MaxConnectionsPerServer\":1000}}],\"GlobalConfiguration\":{\"BaseUrl\":\"\"}}", false });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ protected override void Up(MigrationBuilder migrationBuilder)
values: new object[] { 13, null, "portal", null, "Redis", "Redis", 1, "redis", "{\"Redis\":{\"ConnectionStrings\":null,\"SlidingExpirationInMinute\":10,\"AbsoluteExpirationInMinute\":null,\"AbsoluteExpirationRelativeToNowInMinute\":null}}", false });
migrationBuilder.InsertData("mix_global_setting",
columns: new[] { "id", "last_modified", "service_name", "section_name", "display_name", "description", "tenant_id", "system_name", "settings", "is_encrypt" },
values: new object[] { 14, null, "portal", null, "Mix Heart", "Mix Heart", 1, "mix_heart", "{\"CacheConnection\":null,\"IsCache\":true,\"CacheMode\":\"JSON\",\"databaseProvider\":\"SQLITE\",\"CacheFolder\":\"wwwroot/mixcontent/cache\"}", false });
values: new object[] { 14, null, "portal", null, "Mix Heart", "Mix Heart", 1, "mix_heart", "{\"CacheConnection\":null,\"IsCache\":true,\"CacheMode\":\"HYBRID\",\"CacheFolder\":\"wwwroot/mixcontent/cache\"}", false });
migrationBuilder.InsertData("mix_global_setting",
columns: new[] { "id", "last_modified", "service_name", "section_name", "display_name", "description", "tenant_id", "system_name", "settings", "is_encrypt" },
values: new object[] { 15, null, "portal", null, "Ocelot", "Ocelot", 1, "ocelot", "{\"Routes\":[{\"Priority\":0,\"DownstreamPathTemplate\":\"/{everything}\",\"DownstreamScheme\":\"https\",\"DownstreamHostAndPorts\":[{\"Host\":\"localhost\",\"Port\":5010}],\"UpstreamPathTemplate\":\"/{everything}\",\"UpstreamHttpMethod\":[\"Get\",\"Post\",\"Put\",\"Patch\",\"Delete\"],\"RateLimitOptions\":{\"ClientWhitelist\":[],\"EnableRateLimiting\":true,\"Period\":\"1s\",\"PeriodTimespan\":1,\"Limit\":1000},\"FileCacheOptions\":{\"TtlSeconds\":0,\"Region\":\"Portal_VN\"},\"HttpHandlerOptions\":{\"AllowAutoRedirect\":true,\"UseCookieContainer\":true,\"UseTracing\":true,\"MaxConnectionsPerServer\":1000}}],\"GlobalConfiguration\":{\"BaseUrl\":\"\"}}", false });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ protected override void Up(MigrationBuilder migrationBuilder)
values: new object[] { 13, null, "portal", null, "Redis", "Redis", 1, "redis", "{\"Redis\":{\"ConnectionStrings\":null,\"SlidingExpirationInMinute\":10,\"AbsoluteExpirationInMinute\":null,\"AbsoluteExpirationRelativeToNowInMinute\":null}}", false });
migrationBuilder.InsertData("mix_global_setting",
columns: new[] { "id", "last_modified", "service_name", "section_name", "display_name", "description", "tenant_id", "system_name", "settings", "is_encrypt" },
values: new object[] { 14, null, "portal", null, "Mix Heart", "Mix Heart", 1, "mix_heart", "{\"CacheConnection\":null,\"IsCache\":true,\"CacheMode\":\"JSON\",\"databaseProvider\":\"SQLITE\",\"CacheFolder\":\"wwwroot/mixcontent/cache\"}", false });
values: new object[] { 14, null, "portal", null, "Mix Heart", "Mix Heart", 1, "mix_heart", "{\"CacheConnection\":null,\"IsCache\":true,\"CacheMode\":\"HYBRID\",\"CacheFolder\":\"wwwroot/mixcontent/cache\"}", false });
migrationBuilder.InsertData("mix_global_setting",
columns: new[] { "id", "last_modified", "service_name", "section_name", "display_name", "description", "tenant_id", "system_name", "settings", "is_encrypt" },
values: new object[] { 15, null, "portal", null, "Ocelot", "Ocelot", 1, "ocelot", "{\"Routes\":[{\"Priority\":0,\"DownstreamPathTemplate\":\"/{everything}\",\"DownstreamScheme\":\"https\",\"DownstreamHostAndPorts\":[{\"Host\":\"localhost\",\"Port\":5010}],\"UpstreamPathTemplate\":\"/{everything}\",\"UpstreamHttpMethod\":[\"Get\",\"Post\",\"Put\",\"Patch\",\"Delete\"],\"RateLimitOptions\":{\"ClientWhitelist\":[],\"EnableRateLimiting\":true,\"Period\":\"1s\",\"PeriodTimespan\":1,\"Limit\":1000},\"FileCacheOptions\":{\"TtlSeconds\":0,\"Region\":\"Portal_VN\"},\"HttpHandlerOptions\":{\"AllowAutoRedirect\":true,\"UseCookieContainer\":true,\"UseTracing\":true,\"MaxConnectionsPerServer\":1000}}],\"GlobalConfiguration\":{\"BaseUrl\":\"\"}}", false });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ protected override void Up(MigrationBuilder migrationBuilder)
values: new object[] { 13, null, "portal", null, "Redis", "Redis", 1, "redis", "{\"Redis\":{\"ConnectionStrings\":null,\"SlidingExpirationInMinute\":10,\"AbsoluteExpirationInMinute\":null,\"AbsoluteExpirationRelativeToNowInMinute\":null}}", false });
migrationBuilder.InsertData("mix_global_setting",
columns: new[] { "id", "last_modified", "service_name", "section_name", "display_name", "description", "tenant_id", "system_name", "settings", "is_encrypt" },
values: new object[] { 14, null, "portal", null, "Mix Heart", "Mix Heart", 1, "mix_heart", "{\"CacheConnection\":null,\"IsCache\":true,\"CacheMode\":\"JSON\",\"databaseProvider\":\"SQLITE\",\"CacheFolder\":\"wwwroot/mixcontent/cache\"}", false });
values: new object[] { 14, null, "portal", null, "Mix Heart", "Mix Heart", 1, "mix_heart", "{\"CacheConnection\":null,\"IsCache\":true,\"CacheMode\":\"HYBRID\",\"CacheFolder\":\"wwwroot/mixcontent/cache\"}", false });
migrationBuilder.InsertData("mix_global_setting",
columns: new[] { "id", "last_modified", "service_name", "section_name", "display_name", "description", "tenant_id", "system_name", "settings", "is_encrypt" },
values: new object[] { 15, null, "portal", null, "Ocelot", "Ocelot", 1, "ocelot", "{\"Routes\":[{\"Priority\":0,\"DownstreamPathTemplate\":\"/{everything}\",\"DownstreamScheme\":\"https\",\"DownstreamHostAndPorts\":[{\"Host\":\"localhost\",\"Port\":5010}],\"UpstreamPathTemplate\":\"/{everything}\",\"UpstreamHttpMethod\":[\"Get\",\"Post\",\"Put\",\"Patch\",\"Delete\"],\"RateLimitOptions\":{\"ClientWhitelist\":[],\"EnableRateLimiting\":true,\"Period\":\"1s\",\"PeriodTimespan\":1,\"Limit\":1000},\"FileCacheOptions\":{\"TtlSeconds\":0,\"Region\":\"Portal_VN\"},\"HttpHandlerOptions\":{\"AllowAutoRedirect\":true,\"UseCookieContainer\":true,\"UseTracing\":true,\"MaxConnectionsPerServer\":1000}}],\"GlobalConfiguration\":{\"BaseUrl\":\"\"}}", false });
Expand Down
2 changes: 0 additions & 2 deletions src/platform/mix.mixdb/Services/MixdbStructureService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
using Mix.RepoDb.Repositories;
using Mix.Service.Interfaces;
using Mix.Service.Services;
using Mix.Shared.Services;
using MySqlX.XDevAPI.Common;
using Newtonsoft.Json.Linq;
using RepoDb.Interfaces;
using System.Dynamic;
Expand Down
6 changes: 2 additions & 4 deletions src/platform/mix.service/Services/TenantServiceBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@ public abstract class TenantServiceBase
protected IHttpContextAccessor HttpContextAccessor;
protected IMixTenantService MixTenantService;
protected readonly MixCacheService CacheService;
private readonly MixDitributedCache _cache;

protected TenantServiceBase(IConfiguration configuration, MixDitributedCache cache)
protected TenantServiceBase(IConfiguration configuration, MixCacheService cache)
{
_cache = cache;
CacheService = new MixCacheService(configuration, cache);
CacheService = cache;
}

protected TenantServiceBase(IHttpContextAccessor httpContextAccessor, MixCacheService cacheService, IMixTenantService mixTenantService)
Expand Down

0 comments on commit 598a703

Please sign in to comment.