HttpRuntime.Cache across two request by different user at the same time

38 Views Asked by At

I am bit confused here with caching so thought to ask for an expertise.

I have Inserted HttpRuntime.Cache

I have 2 users via 2 different login, working on the same caching at the same time i.e., one user is clearing it and another one accessing it.

I have written below code while accessing caching.

if (HttpRuntime.Cache[MyKey] == null)
 {
     
     HttpRuntime.Cache.Insert(MyKey, CityCollection);
     
 }
 else
 {
     CityCollection = (List<CityDTO>)HttpRuntime.Cache[MyKey];        
 }

Will it give me an object reference for 2nd user? Or 2nd user will get collection form caching?

Or Does it work as per the request?

0

There are 0 best solutions below