Which code segment should you add?

You are implementing a method in an ASP.NET application that includes the following requirements.
Store the number of active bugs in the cache. The value should remain in the cache when there are
calls more often than every 15 seconds. The value should be removed from the cache after 60
seconds. You need to add code to meet the requirements. Which code segment should you add?

You are implementing a method in an ASP.NET application that includes the following requirements.
Store the number of active bugs in the cache. The value should remain in the cache when there are
calls more often than every 15 seconds. The value should be removed from the cache after 60
seconds. You need to add code to meet the requirements. Which code segment should you add?

A.
Cache.Insert(“ActiveBugs”, result, null, DateTime.Now.AddSeconds(60), TimeSpan.
FromSeconds(15));

B.
Cache.Insert(“Trigger”, DateTime.Now, null, DateTime.Now.AddSeconds(60), Cache.
NoSlidingExpiration);

CacheDependency cd = new CacheDependency(null, new string[] { “Trigger” });
Cache.Insert(“ActiveBugs”, result, cd, Cache.NoAbsoluteExpiration, TimeSpan.
FromSeconds(15));

C.
Cache.Insert(“ActiveBugs”, result, null, Cache.NoAbsoluteExpiration, TimeSpan.
FromSeconds(15));
CacheDependency cd = new CacheDependency(null, new string[] { “ActiveBugs” });
Cache.Insert(“Trigger”, DateTime.Now, cd, DateTime.Now.AddSeconds(60), Cache.
NoSlidingExpiration);

D.
CacheDependency cd = new CacheDependency(null, new string[] { “Trigger” });
Cache.Insert(“Trigger”, DateTime.Now, null, DateTime.Now.AddSeconds(60), Cache.
NoSlidingExpiration);
Cache.Insert(“ActiveBugs”, result, cd, Cache.NoAbsoluteExpiration, TimeSpan.
FromSeconds(15));



Leave a Reply 1

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