diff --git a/examples/DictionaryExample/DictionaryExample.csproj b/examples/DictionaryExample/DictionaryExample.csproj index 47fb1c16..e37d4e0f 100644 --- a/examples/DictionaryExample/DictionaryExample.csproj +++ b/examples/DictionaryExample/DictionaryExample.csproj @@ -9,9 +9,6 @@ - - - - + diff --git a/examples/DictionaryExample/Program.cs b/examples/DictionaryExample/Program.cs index 759753b6..9274013c 100644 --- a/examples/DictionaryExample/Program.cs +++ b/examples/DictionaryExample/Program.cs @@ -25,7 +25,7 @@ public async static Task Main() var cacheName = ReadCacheName(); // Set up the client - using var client = new SimpleCacheClient(Configurations.Laptop.V1(), authToken, TimeSpan.FromSeconds(60)); + using ICacheClient client = new CacheClient(Configurations.Laptop.V1(), authToken, TimeSpan.FromSeconds(60)); await EnsureCacheExistsAsync(client, cacheName); // Set a value @@ -205,7 +205,7 @@ private static string ReadCacheName() return "default-cache"; } - private static async Task EnsureCacheExistsAsync(ISimpleCacheClient client, string cacheName) + private static async Task EnsureCacheExistsAsync(ICacheClient client, string cacheName) { _logger.LogInformation($"Creating cache {cacheName} if it doesn't already exist."); var createCacheResponse = await client.CreateCacheAsync(cacheName); diff --git a/examples/MomentoApplication/MomentoApplication.csproj b/examples/MomentoApplication/MomentoApplication.csproj index b4960d53..af213525 100644 --- a/examples/MomentoApplication/MomentoApplication.csproj +++ b/examples/MomentoApplication/MomentoApplication.csproj @@ -9,9 +9,11 @@ - + + + diff --git a/examples/MomentoApplication/Program.cs b/examples/MomentoApplication/Program.cs index c9541b5a..8bee2b34 100644 --- a/examples/MomentoApplication/Program.cs +++ b/examples/MomentoApplication/Program.cs @@ -11,7 +11,7 @@ TimeSpan DEFAULT_TTL = TimeSpan.FromSeconds(60); -using (SimpleCacheClient client = new SimpleCacheClient(Configurations.Laptop.V1(), authProvider, DEFAULT_TTL)) +using (ICacheClient client = new CacheClient(Configurations.Laptop.V1(), authProvider, DEFAULT_TTL)) { await AdvancedExamples.CreateCacheExample(client); await AdvancedExamples.ListCachesExample(client); @@ -29,7 +29,7 @@ public class AdvancedExamples { const string KEY = "MyKey"; const string VALUE = "MyData"; - public static async Task CreateCacheExample(ISimpleCacheClient client) + public static async Task CreateCacheExample(ICacheClient client) { Console.WriteLine($"Creating cache {CACHE_NAME}"); @@ -55,7 +55,7 @@ public static async Task CreateCacheExample(ISimpleCacheClient client) } } - public static async Task ListCachesExample(ISimpleCacheClient client) { + public static async Task ListCachesExample(ICacheClient client) { Console.WriteLine("\nListing caches:"); ListCachesResponse listCachesResponse = await client.ListCachesAsync(); if (listCachesResponse is ListCachesResponse.Success listCachesSuccess) @@ -72,7 +72,7 @@ public static async Task ListCachesExample(ISimpleCacheClient client) { } } - public static async Task SetGetDeleteExample(ISimpleCacheClient client) { + public static async Task SetGetDeleteExample(ICacheClient client) { Console.WriteLine($"\nSetting key: {KEY} with value: {VALUE}"); var setResponse = await client.SetAsync(CACHE_NAME, KEY, VALUE); if (setResponse is CacheSetResponse.Error setError) @@ -108,7 +108,7 @@ public static async Task SetGetDeleteExample(ISimpleCacheClient client) { } } - public static async Task DeleteCacheExample(ISimpleCacheClient client) { + public static async Task DeleteCacheExample(ICacheClient client) { Console.WriteLine($"\nDeleting cache {CACHE_NAME}"); var deleteCacheResponse = await client.DeleteCacheAsync(CACHE_NAME); @@ -133,7 +133,7 @@ public static void EagerConnectionExample() var config = Configurations.Laptop.V1(); var eagerConnectionConfig = config.WithTransportStrategy(config.TransportStrategy.WithEagerConnectionTimeout(TimeSpan.FromSeconds(10))); Console.WriteLine("Creating a momento client with eager connection"); - using (SimpleCacheClient client = new SimpleCacheClient(eagerConnectionConfig, authProvider, defaultTtl)) { + using (CacheClient client = new CacheClient(eagerConnectionConfig, authProvider, defaultTtl)) { Console.WriteLine("Successfully created a momento client with eager connection"); } diff --git a/examples/MomentoExamples.sln b/examples/MomentoExamples.sln index a4fba64d..7b6ef814 100644 --- a/examples/MomentoExamples.sln +++ b/examples/MomentoExamples.sln @@ -13,6 +13,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MomentoUsage", "MomentoUsag EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DictionaryExample", "DictionaryExample\DictionaryExample.csproj", "{61F79DA8-BA7F-4F6E-B4EA-29DACF9C7571}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Momento.Sdk", "..\src\Momento.Sdk\Momento.Sdk.csproj", "{ABDFBF7A-9639-4449-91E3-4558C366D297}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -39,6 +41,10 @@ Global {61F79DA8-BA7F-4F6E-B4EA-29DACF9C7571}.Debug|Any CPU.Build.0 = Debug|Any CPU {61F79DA8-BA7F-4F6E-B4EA-29DACF9C7571}.Release|Any CPU.ActiveCfg = Release|Any CPU {61F79DA8-BA7F-4F6E-B4EA-29DACF9C7571}.Release|Any CPU.Build.0 = Release|Any CPU + {ABDFBF7A-9639-4449-91E3-4558C366D297}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ABDFBF7A-9639-4449-91E3-4558C366D297}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ABDFBF7A-9639-4449-91E3-4558C366D297}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ABDFBF7A-9639-4449-91E3-4558C366D297}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/examples/MomentoFSharpApplication/MomentoFSharpApplication.fsproj b/examples/MomentoFSharpApplication/MomentoFSharpApplication.fsproj index 4f5b9833..8e1c5ea5 100644 --- a/examples/MomentoFSharpApplication/MomentoFSharpApplication.fsproj +++ b/examples/MomentoFSharpApplication/MomentoFSharpApplication.fsproj @@ -10,8 +10,6 @@ - - - + diff --git a/examples/MomentoFSharpApplication/Program.fs b/examples/MomentoFSharpApplication/Program.fs index 531da6f5..28f4bbfc 100644 --- a/examples/MomentoFSharpApplication/Program.fs +++ b/examples/MomentoFSharpApplication/Program.fs @@ -10,7 +10,7 @@ let authProvider = new EnvMomentoTokenProvider("MOMENTO_AUTH_TOKEN") let exerciseCache() = ( printfn "Howdy" - using(new SimpleCacheClient(Configurations.Laptop.V1(), authProvider, DEFAULT_TTL)) (fun client -> + using(new CacheClient(Configurations.Laptop.V1(), authProvider, DEFAULT_TTL)) (fun client -> let createCacheResult = client.CreateCacheAsync(CACHE_NAME) |> Async.AwaitTask printfn("Listing caches:") diff --git a/examples/MomentoLoadGen/MomentoLoadGen.csproj b/examples/MomentoLoadGen/MomentoLoadGen.csproj index 635d065f..117fb9e1 100644 --- a/examples/MomentoLoadGen/MomentoLoadGen.csproj +++ b/examples/MomentoLoadGen/MomentoLoadGen.csproj @@ -23,11 +23,11 @@ - runtime; build; native; contentfiles; analyzers; buildtransitive all + diff --git a/examples/MomentoLoadGen/Program.cs b/examples/MomentoLoadGen/Program.cs index d3d7abc3..c0254be6 100644 --- a/examples/MomentoLoadGen/Program.cs +++ b/examples/MomentoLoadGen/Program.cs @@ -92,7 +92,7 @@ public async Task Run() { var authProvider = new EnvMomentoTokenProvider("MOMENTO_AUTH_TOKEN"); - using (var momento = new SimpleCacheClient( + using (ICacheClient momento = new CacheClient( _momentoClientConfig, authProvider, TimeSpan.FromSeconds(CACHE_ITEM_TTL_SECONDS) @@ -146,7 +146,7 @@ public async Task Run() private async Task LaunchAndRunWorkers( - SimpleCacheClient client, + ICacheClient client, CsharpLoadGeneratorContext context, int workerId, int delayMillisBetweenRequests, @@ -201,7 +201,7 @@ private void PrintStats(LongHistogram setsAccumulatingHistogram, LongHistogram g _logger.LogInformation($"Load gen data point:\t{_options.numberOfConcurrentRequests}\t{Tps(context, context.GlobalRequestCount)}\t{getsAccumulatingHistogram.GetValueAtPercentile(50)}\t{getsAccumulatingHistogram.GetValueAtPercentile(99.9)}"); } - private async Task IssueAsyncSetGet(SimpleCacheClient client, CsharpLoadGeneratorContext context, int workerId, int operationId, int delayMillisBetweenRequests) + private async Task IssueAsyncSetGet(ICacheClient client, CsharpLoadGeneratorContext context, int workerId, int operationId, int delayMillisBetweenRequests) { var cacheKey = $"worker{workerId}operation{operationId}"; @@ -247,7 +247,7 @@ Func>> block return result.Item2; } - private async Task> IssueGetRequest(SimpleCacheClient client, String cacheKey) + private async Task> IssueGetRequest(ICacheClient client, String cacheKey) { var getResponse = await client.GetAsync(CACHE_NAME, cacheKey); if (getResponse is CacheGetResponse.Hit hit) @@ -268,7 +268,7 @@ Func>> block } } - private async Task> IssueSetRequest(SimpleCacheClient client, String cacheKey, String cacheValue) + private async Task> IssueSetRequest(ICacheClient client, String cacheKey, String cacheValue) { var setResponse = await client.SetAsync(CACHE_NAME, cacheKey, cacheValue); if (setResponse is CacheSetResponse.Success success) diff --git a/examples/MomentoUsage/MomentoUsage.csproj b/examples/MomentoUsage/MomentoUsage.csproj index b2670136..149fa411 100644 --- a/examples/MomentoUsage/MomentoUsage.csproj +++ b/examples/MomentoUsage/MomentoUsage.csproj @@ -12,10 +12,10 @@ - runtime; build; native; contentfiles; analyzers; buildtransitive all + diff --git a/examples/MomentoUsage/Program.cs b/examples/MomentoUsage/Program.cs index 0b579197..137d5fd4 100644 --- a/examples/MomentoUsage/Program.cs +++ b/examples/MomentoUsage/Program.cs @@ -10,7 +10,7 @@ const string VALUE = "MyData"; TimeSpan DEFAULT_TTL = TimeSpan.FromSeconds(60); -using (SimpleCacheClient client = new SimpleCacheClient(Configurations.Laptop.V1(), authProvider, DEFAULT_TTL)) +using (ICacheClient client = new CacheClient(Configurations.Laptop.V1(), authProvider, DEFAULT_TTL)) { var createCacheResponse = await client.CreateCacheAsync(CACHE_NAME); if (createCacheResponse is CreateCacheResponse.Error createError)