private static void RegisterImpl(string key, string role, OrganizationCache.LoadHandler loader, bool skuMatch = true, OrganizationCacheExpirationType expiration = OrganizationCacheExpirationType.Default, TimeSpan?customExpireTime = null) { if (expiration == OrganizationCacheExpirationType.Custom != (customExpireTime != null)) { throw new ArgumentException("CustomExpireTime must be specified together with expiration as Custom."); } TimeSpan item = (expiration == OrganizationCacheExpirationType.Default) ? OrganizationCache.orgCacheLifeTime : ((expiration == OrganizationCacheExpirationType.Never) ? TimeSpan.MaxValue : customExpireTime.Value); Tuple <bool, string, OrganizationCache.LoadHandler, TimeSpan> value = new Tuple <bool, string, OrganizationCache.LoadHandler, TimeSpan>(skuMatch, role, loader, item); OrganizationCache.definitionStore.Add(key, value); }
public static void Register(string key, string role, OrganizationCache.LoadHandler loader, bool skuMatch = true, OrganizationCacheExpirationType expiration = OrganizationCacheExpirationType.Default, TimeSpan?customExpireTime = null) { lock (OrganizationCache.definitionStore) { OrganizationCache.RegisterImpl(key, role, loader, skuMatch, expiration, customExpireTime); } }