News:

SQL Table To C# Entity Model ConverterEntity Model (Class Properties) to SQL Table ConverterIf you encounter any trouble visiting our site, please contact us.

Advertisement

Looking for job. Try JobLoader- First ever job search engine in Bangladesh. All open bd jobs now a single mouse click away.

;

Retrieve the number of active bugs from the cache, if the number is present. If the number is not found in the cache, call a method
named GetActiveBugs, and save the result under the ActiveBugs cache key. Ensure that cached data expires after 30 seconds. You need to add code to fulfill the requirements.

Which code segment should you add?

  1. int numOfActiveBugs = (int)Cache["ActiveBugs"];
    if (!numOfActiveBugs.HasValue)
    {
    int result = GetActiveBugs();
    Cache.Insert("ActiveBugs", result, null,
    DateTime.Now.AddSeconds(30), Cache.NoSlidingExpiration);
    numOfActiveBugs = result;
    }
    ActiveBugs = numOfActiveBugs.Value;
    
  2. int numOfActiveBugs = (int) Cache.Get("ActiveBugs");
    if (numOfActiveBugs != 0)
    {
    int result = GetActiveBugs();
    Cache.Insert("ActiveBugs", result, null,
    DateTime.Now.AddSeconds(30), Cache.NoSlidingExpiration);
    numOfActiveBugs = result;
    }
    ActiveBugs = numOfActiveBugs;
    
  3. int numOfActiveBugs = 0;
    if (Cache["ActiveBugs"] == null)
    {
    int result = GetActiveBugs();
    Cache.Add("ActiveBugs", result, null, DateTime.Now.AddSeconds(30), Cache.NoSlidingExpiration,
    CacheItemPriority.Normal, null); Cache.NoSlidingExpiration, CacheItemPriority.Normal, null);
    numOfActiveBugs = result;
    }
    ActiveBugs = numOfActiveBugs;
    
  4. int numOfActiveBugs = (int?)Cache["ActiveBugs"];
    if (!numOfActiveBugs.HasValue)
    {
    int result = GetActiveBugs();
    Cache.Insert("ActiveBugs", result, null,
    Cache.NoAbsoluteExpiration, TimeSpan.FromSeconds(30));
    numOfActiveBugs = result;
    }
    ActiveBugs = numOfActiveBugs.Value;
    
Answer: Answer is a
comments powered by Disqus
Advertisement

BCS Preparation now even more easy. ReadBD is the place where you can find all kind of resources to be successful in BCS,Bank,Islami Bank exam and interview.

Looking for job. Try JobLoader- First ever job search engine in Bangladesh. All open bd jobs now a single mouse click away.

;