Which code segment can you use?

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. Chooseall that apply.)

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. Chooseall 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());



Leave a Reply 0

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