From 4d8cfc10382105b0acbd94df93ad3d05ff91db54 Mon Sep 17 00:00:00 2001 From: vnugent Date: Wed, 6 Mar 2024 21:30:58 -0500 Subject: refactor: #2 Centralize server state, default discovery endpoints & more --- .../src/ApiModel/CacheSiteAdapter.cs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'lib/VNLib.Data.Caching.Extensions/src/ApiModel') diff --git a/lib/VNLib.Data.Caching.Extensions/src/ApiModel/CacheSiteAdapter.cs b/lib/VNLib.Data.Caching.Extensions/src/ApiModel/CacheSiteAdapter.cs index 99acfd5..b6add7d 100644 --- a/lib/VNLib.Data.Caching.Extensions/src/ApiModel/CacheSiteAdapter.cs +++ b/lib/VNLib.Data.Caching.Extensions/src/ApiModel/CacheSiteAdapter.cs @@ -1,5 +1,5 @@ /* -* Copyright (c) 2023 Vaughn Nugent +* Copyright (c) 2024 Vaughn Nugent * * Library: VNLib * Package: VNLib.Data.Caching.Extensions @@ -22,6 +22,7 @@ * along with this program. If not, see https://www.gnu.org/licenses/. */ +using System; using System.Net; using System.Text; using System.Threading; @@ -39,6 +40,22 @@ namespace VNLib.Data.Caching.Extensions.ApiModel /// internal sealed class CacheSiteAdapter : RestSiteAdapterBase { + /* + * Lazy to defer errors for debuggong + */ + private static readonly Lazy _lazy = new(() => ConfigureAdapter(2)); + + internal static CacheSiteAdapter Instance => _lazy.Value; + + private static CacheSiteAdapter ConfigureAdapter(int maxClients) + { + CacheSiteAdapter adapter = new(maxClients); + //Configure the site endpoints + adapter.BuildEndpoints(ServiceEndpoints.Definition); + return adapter; + } + + protected override RestClientPool Pool { get; } public CacheSiteAdapter(int maxClients) -- cgit