exam questions

Exam 70-487 All Questions

View all questions & answers for the 70-487 exam

Exam 70-487 topic 3 question 11 discussion

Actual exam question from Microsoft's 70-487
Question #: 11
Topic #: 3
[All 70-487 Questions]

The GetVendors() action in the ProcessedOrderController controller is querying the database each time it is run. The GetVendors() action must query the database only if the cache is null.
You need to add code to the action at line PC33 to cache the data.
Which code segment can you use? (Each correct answer presents a complete solution. Choose all that apply.)

  • A. cache.Set(new CacheItem("vendorKey", vendors), GetVendorPolicy());
  • B. cache.Add("vendors", vendors, new CacheItemPolicy());
  • C. cache.Add(new CacheItem("vendorKey", vendors) , GetVendorPolicy());
  • D. cache.AddOrGetExisting("vendorKey", context, new CacheItemPolicy()); AC
Show Suggested Answer Hide Answer
Suggested Answer: Explanation 🗳️

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
JithJohn
Highly Voted 5 years, 5 months ago
A and C are correct
upvoted 12 times
...
MaverickCalibre
Highly Voted 5 years, 6 months ago
https://docs.microsoft.com/en-us/dotnet/api/system.runtime.caching.memorycache?redirectedfrom=MSDN&view=netframework-4.8#methods
upvoted 7 times
...
pizzaHawai
Most Recent 4 years, 5 months ago
A & C are correct. D would have been if correct if 'context' would be replaced with 'vendors'. Add() will perform a AddOrGetExisting() behind the scenes https://stackoverflow.com/a/20559780/4884274
upvoted 1 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 ...