PrepAway - Latest Free Exam Questions & Answers

Which two actions should you perform?

You are developing a Windows Communication Foundation (WCF) service to provide an
in-memory cache. The following code is part of your solution. (Line numbers are included for
reference only.) 01 02 Public Interface IlnMemoryCacheService 03 04
<OperationContract()> 05 Function GetCachedItem( ByVal key As String) As String 06 07
<OperationContract() > 08 Sub CacheItem( ByVal key As String, ByVal item As String) 09
10 End Interface 11 12 <ServiceBehavior(
InstanceContextMode:=InstanceContextHode.Single)> 13 Public Class CacheService 14
Implements IlnHemoryCacheService 15 16 Dim cache As Hashtatale – New Hashtable)> 17
18 Public Function GetCachedItem( ByVal key As String) As String mplements
IInHemoryCacheService.GetCachedltem 19 20 Return cache (key) .ToStrlng() 21 22 End
Function 23 24 Public Sub Cacheltem( ByVal key As String, ByVal item As String)
Implements ilnMemoryCacheService.Cacheltem Then 25 26 If (cache.Contains(key) 27
cache.Remove(key) 28 End If 29 30 cache.Add(key, item) 31 32 End Sub 33 34 End Class
Users report that the cache is getting updated with cache changes of other users. You need
to ensure that each user’s cache is maintained and isolated from other users. Which two
actions should you perform? (Each correct answer presents part of the solution. Choose
two.)

PrepAway - Latest Free Exam Questions & Answers

A.
Insert the following code at line 01.
<ServiceContract(SessionHode:=SessionHode.Required)>

B.
At line 12, replace InstanceContextHode.Single with InstanceContextHode.PerCall.

C.
At line 12, replace InstanceContextHode.Single with InstanceContextHode.PerSession.

D.
Insert the following code at line 01.
<ServiceContract(SessionMode:=SessionHode.NotAllowed)>


Leave a Reply