
Explanation/Reference:
Explanation:
Box 1: var cache = connection.GetDatabase():
Oncethe connection is established, return a reference to the redis cache database by calling the ConnectionMultiplexer.GetDatabase method.
Box 2: cache StringSet("color", colorSelection,TimeSpan.FromMinutes(90)); The TimeSpanFromMinutes method returns a TimeSpan that represents a specified number of minutes, where the specification is accurate to the nearest millisecond.
Example: The following code snippet shows how to set an expiration time of 90 minutes on a key.
// Add a key with an expiration time of 90minutes
await cache.StringSetAsync("data:key1", 99, TimeSpan.FromMinutes(90));
References: https://docs.microsoft.com/en-us/azure/redis-cache/cache-dotnet-how-to-use-azure-redis- cache
https://msdn.microsoft.com/en-us/library/system.timespan.fromminutes(v=vs.110).aspx