exam questions

Exam 70-486 All Questions

View all questions & answers for the 70-486 exam

Exam 70-486 topic 1 question 86 discussion

Actual exam question from Microsoft's 70-486
Question #: 86
Topic #: 1
[All 70-486 Questions]

HOTSPOT -
You are developing an ASP.NET MVC application that will be hosted on Microsoft Azure. The application includes the StackExchange.Redis client package. A variable named CacheConnectionConfiguration stores the cache endpoint URL and the password to connect to the cache.
The application must store a user's color selection by using the Azure Redis cache. The cached value must expire after 90 minutes. You need to cache the user's color selection.
How should you complete the relevant code? To answer, choose the appropriate code segment from each list in the answer area.
Hot Area:

Show Suggested Answer Hide Answer
Suggested Answer:
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

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
hungry_ape9000
Highly Voted 5 years, 2 months ago
FINAL ANSWER: var cache = cache.GetDatabase() cache.StringSet("color", colorSelection, TimeSpan.FromMinutes(90));
upvoted 7 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...