Hi,
from the MS docs:
The default session provider in ASP.NET Core loads the session record from the underlying IDistributedCache store asynchronously only if the ISession.LoadAsync method is explicitly called before the TryGetValue, Set, or Remove methods. If LoadAsync is not called first, the underlying session record is loaded synchronously, which could potentially impact the ability of the app to scale.
Since I have the SessionExtensions and set/get only one serializable object throughout my app is it enough to just call the LoadAsync at the beginning of the Get and Set extension methods to have the session loading async?
public static class SessionExtensions { public static void Set<T>(this ISession session, string key, T value) {session.LoadAsync(); session.SetString(key, JsonConvert.SerializeObject(value)); } public static T Get<T>(this ISession session,string key) {session.LoadAsync(); var value = session.GetString(key); return value == null ? default(T) : JsonConvert.DeserializeObject<T>(value); } }