From 6f247c33f52ca3cdd0ec21dc20b27e9b2860d758 Mon Sep 17 00:00:00 2001 From: Pierre Tessier Date: Tue, 7 Mar 2023 20:35:12 -0500 Subject: [PATCH 1/2] use 60m TTL for cart cache Signed-off-by: Pierre Tessier --- src/cartservice/src/cartstore/RedisCartStore.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cartservice/src/cartstore/RedisCartStore.cs b/src/cartservice/src/cartstore/RedisCartStore.cs index 87541d8496..61756337e8 100644 --- a/src/cartservice/src/cartstore/RedisCartStore.cs +++ b/src/cartservice/src/cartstore/RedisCartStore.cs @@ -148,6 +148,7 @@ public async Task AddItemAsync(string userId, string productId, int quantity) } await db.HashSetAsync(userId, new[]{ new HashEntry(CART_FIELD_NAME, cart.ToByteArray()) }); + await db.KeyExpireAsync(userId, TimeSpan.FromMinutes(60)); } catch (Exception ex) { @@ -166,6 +167,7 @@ public async Task EmptyCartAsync(string userId) // Update the cache with empty cart for given user await db.HashSetAsync(userId, new[] { new HashEntry(CART_FIELD_NAME, emptyCartBytes) }); + await db.KeyExpireAsync(userId, TimeSpan.FromMinutes(60)); } catch (Exception ex) { From 67083b9bf6b03860a03767e79dfe54c1671a87fa Mon Sep 17 00:00:00 2001 From: Pierre Tessier Date: Fri, 10 Mar 2023 09:14:11 -0500 Subject: [PATCH 2/2] add 60m TTL for cart Signed-off-by: Pierre Tessier --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0cf25d5f1f..2911de4765 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ release. * spanmetrics dashboard service&operation rates%latencies ([#787](https://github.com/open-telemetry/opentelemetry-demo/pull/787)) +* [cart] use 60m TTL for cart entries in redis +([#779](https://github.com/open-telemetry/opentelemetry-demo/pull/779)) ## v0.1.0