Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update examples to latest SDK version #279

Merged
merged 1 commit into from
Oct 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/MomentoApplication/MomentoApplication.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Momento.Sdk" Version="0.33.0" />
<PackageReference Include="Momento.Sdk" Version="0.34.0" />
</ItemGroup>
<ItemGroup>
<None Remove="Microsoft.Extensions.Logging.Console" />
Expand Down
2 changes: 1 addition & 1 deletion examples/MomentoApplication/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
CacheGetResponse getResponse = await client.GetAsync(CACHE_NAME, KEY);
if (getResponse is CacheGetResponse.Hit getHit)
{
Console.WriteLine($"Looked up value: {getHit.String()}, Stored value: {VALUE}");
Console.WriteLine($"Looked up value: {getHit.ValueString}, Stored value: {VALUE}");
} else if (getResponse is CacheGetResponse.Miss)
{
// This shouldn't be fatal but should be reported.
Expand Down
2 changes: 1 addition & 1 deletion examples/MomentoLoadGen/MomentoLoadGen.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" />
<PackageReference Include="Momento.Sdk" Version="0.31.0" />
<PackageReference Include="Momento.Sdk" Version="0.34.0" />
<PackageReference Include="HdrHistogram" Version="2.5.0" />
</ItemGroup>
</Project>
11 changes: 4 additions & 7 deletions examples/MomentoLoadGen/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using HdrHistogram;
using Microsoft.Extensions.Logging;
using Momento.Sdk;
using Momento.Sdk.Auth;
using Momento.Sdk.Config;
using Momento.Sdk.Exceptions;
using Momento.Sdk.Responses;
Expand Down Expand Up @@ -88,15 +89,11 @@ public CsharpLoadGenerator(ILoggerFactory loggerFactory, IConfiguration momentoC

public async Task Run()
{
string? authToken = System.Environment.GetEnvironmentVariable("MOMENTO_AUTH_TOKEN");
if (authToken == null)
{
throw new Exception("Missing required environment variable MOMENTO_AUTH_TOKEN");
}
ICredentialProvider authProvider = new EnvMomentoTokenProvider("MOMENTO_AUTH_TOKEN");

var momento = new SimpleCacheClient(
_momentoClientConfig,
authToken,
authProvider,
CACHE_ITEM_TTL_SECONDS,
_loggerFactory
);
Expand Down Expand Up @@ -236,7 +233,7 @@ private async Task IssueAsyncSetGet(SimpleCacheClient client, CsharpLoadGenerato
await Task.Delay((int)(delayMillisBetweenRequests - getDuration));
}

string value = hitResponse.String();
string value = hitResponse.ValueString;
string valueString = $"{value.Substring(0, 10)}... (len: {value.Length})";

var globalRequestCount = context.GlobalRequestCount;
Expand Down
2 changes: 1 addition & 1 deletion examples/MomentoUsage/MomentoUsage.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
<None Remove="Momento.Sdk" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Momento.Sdk" Version="0.33.0" />
<PackageReference Include="Momento.Sdk" Version="0.34.0" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion examples/MomentoUsage/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
CacheGetResponse getResponse = await client.GetAsync(CACHE_NAME, KEY);
if (getResponse is CacheGetResponse.Hit hitResponse)
{
Console.WriteLine($"Looked up value: {hitResponse.String()}, Stored value: {VALUE}");
Console.WriteLine($"Looked up value: {hitResponse.ValueString}, Stored value: {VALUE}");
} else if (getResponse is CacheGetResponse.Error getError) {
Console.WriteLine($"Error getting value: {getError.Message}");
}
Expand Down