Which two changes should you make to the code?

You are developing an ASP.NET MVC application that delivers real-time game results to sports fans. The
application includes the following code. Line numbers are included for reference only.

The source data for the game results is updated every 30 seconds.
Testers report the following issues with the application:
They report seeing other user’s name when they sign in to the application.
They report delays in seeing the latest game results.
You need to correct the performance issues.
Which two changes should you make to the code? Each correct answer presents part of the solution.

You are developing an ASP.NET MVC application that delivers real-time game results to sports fans. The
application includes the following code. Line numbers are included for reference only.

The source data for the game results is updated every 30 seconds.
Testers report the following issues with the application:
They report seeing other user’s name when they sign in to the application.
They report delays in seeing the latest game results.
You need to correct the performance issues.
Which two changes should you make to the code? Each correct answer presents part of the solution.

A.
Replace the code at line 07 with the following codesegment:[OutputCache(Duration = 30, VaryByParam =
“none”, Location = OutputCacheLocation.Client, NoStore = true)]

B.
Replace the code at line 12 with the following code segment:[OutputCache(Duration = 30, VaryByParam =
“none”, Location = OutputCacheLocation.Server, NoStore = true)]

C.
Replace the code at line 07 with the following code segment:[OutputCache(Duration = 3600, VaryByParam
= “none”, Location = OutputCacheLocation.Server, NoStore = false)]

D.
Replace the code at line 12 with the following code segment:[OutputCache(Duration = 3600, VaryByParam
= “none”, Location = OutputCacheLocation.Client, NoStore = true)]

Explanation:
B: They report delays in seeing the latest game results. This is the output of the GetResults() function. We
decrease the Duration in the cache for this function from 3600 to 30. This is one line 12.
A: They report seeing other user’s name when they sign in to the application. This is the output of the
GetUserInfo() function. We should change the OutputCacheLocation ofthe caching of this function from Server
to Client. This is on line 7.
Note: The OutputCacheLocation.Client option indicates that the content should be cached at the requesting
client. Any requests for the same resource made from the same client within the expiry period, will be servedout the client’s cache, without a network request being made to the server.
The OutputCacheLocation.Server option indicates that the content will be cached at the origin server. This
content will be served for subsequent requests made by the initial client and any other client requesting the
same resource within the expiry period.
https://growlycode.wordpress.com/2014/01/10/mvc4-outputcache-location-basics/



Leave a Reply 0

Your email address will not be published. Required fields are marked *