Skip to content

Commit

Permalink
refactor: change CacheUpdateTtlResponse.Hit to .Set
Browse files Browse the repository at this point in the history
This aligns with the Go SDK verbiage.
  • Loading branch information
malandis committed May 4, 2023
1 parent 2089548 commit 1fd29c5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Momento.Sdk/Internal/ScsDataClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ private async Task<CacheUpdateTtlResponse> SendUpdateTtlAsync(string cacheName,

if (response.ResultCase == _UpdateTtlResponse.ResultOneofCase.Set)
{
return this._logger.LogTraceRequestSuccess(REQUEST_TYPE_UPDATE_TTL, cacheName, key, null, ttl, new CacheUpdateTtlResponse.Hit());
return this._logger.LogTraceRequestSuccess(REQUEST_TYPE_UPDATE_TTL, cacheName, key, null, ttl, new CacheUpdateTtlResponse.Set());
}
else if (response.ResultCase == _UpdateTtlResponse.ResultOneofCase.Missing)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Momento.Sdk/Responses/CacheUpdateTtlResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Momento.Sdk.Responses;
/// response object is resolved to a type-safe object of one of
/// the following subtypes:
/// <list type="bullet">
/// <item><description>CacheUpdateTtlResponse.Hit</description></item>
/// <item><description>CacheUpdateTtlResponse.Set</description></item>
/// <item><description>CacheUpdateTtlResponse.Miss</description></item>
/// <item><description>CacheUpdateTtlResponse.Error</description></item>
/// </list>
Expand Down Expand Up @@ -40,7 +40,7 @@ public abstract class CacheUpdateTtlResponse
/// <summary>
/// Indicates the key was found in the cache and the ttl was updated.
/// </summary>
public class Hit : CacheUpdateTtlResponse { }
public class Set : CacheUpdateTtlResponse { }

/// <summary>
/// Indicates the key was not found in the cache, hence the ttl was not updated.
Expand Down
8 changes: 4 additions & 4 deletions tests/Integration/Momento.Sdk.Tests/TtlTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public async Task UpdateTtlAsync_KeyIsStringAndMissing_IsMiss()
}

[Fact]
public async Task UpdateTtlAsync_KeyIsByteArrayAndExists_UpdatesTtl()
public async Task UpdateTtlAsync_KeyIsByteArrayAndExists_IsSet()
{
// Add an item with a minute ttl
byte[] key = Utils.NewGuidByteArray();
Expand All @@ -73,7 +73,7 @@ public async Task UpdateTtlAsync_KeyIsByteArrayAndExists_UpdatesTtl()

// Let's make the TTL really small.
var updateTtlResponse = await client.UpdateTtlAsync(cacheName, key, TimeSpan.FromSeconds(1));
Assert.True(updateTtlResponse is CacheUpdateTtlResponse.Hit, $"UpdateTtl call should have been Hit but was: {response}");
Assert.True(updateTtlResponse is CacheUpdateTtlResponse.Set, $"UpdateTtl call should have been Set but was: {response}");

// Wait for the TTL to expire
await Task.Delay(1000);
Expand All @@ -85,7 +85,7 @@ public async Task UpdateTtlAsync_KeyIsByteArrayAndExists_UpdatesTtl()
}

[Fact]
public async Task UpdateTtlAsync_KeyIsStringAndExists_UpdatesTtl()
public async Task UpdateTtlAsync_KeyIsStringAndExists_IsSet()
{
// Add an item with a minute ttl
string key = Utils.NewGuidString();
Expand All @@ -100,7 +100,7 @@ public async Task UpdateTtlAsync_KeyIsStringAndExists_UpdatesTtl()

// Let's make the TTL really small.
var updateTtlResponse = await client.UpdateTtlAsync(cacheName, key, TimeSpan.FromSeconds(1));
Assert.True(updateTtlResponse is CacheUpdateTtlResponse.Hit, $"UpdateTtl call should have been Hit but was: {response}");
Assert.True(updateTtlResponse is CacheUpdateTtlResponse.Set, $"UpdateTtl call should have been Set but was: {response}");

// Wait for the TTL to expire
await Task.Delay(1000);
Expand Down

0 comments on commit 1fd29c5

Please sign in to comment.