/// <summary> /// Gets the specified tag. /// </summary> /// <param name="tag">The tag.</param> /// <param name="name">The name.</param> /// <param name="registration">The registration.</param> /// <param name="header">The header.</param> /// <returns></returns> /// <exception cref="System.ArgumentNullException"></exception> public object Get(object tag, string name, IServiceCacheRegistration registration, out CacheItemHeader header) { if (registration == null) { throw new ArgumentNullException("registration"); } header = (registration.UseHeaders ? (CacheItemHeader)Cache.Get(name + "#") : null); return(Cache.Get(name)); }
/// <summary> /// Gets the specified tag. /// </summary> /// <param name="tag">The tag.</param> /// <param name="name">The name.</param> /// <param name="registration">The registration.</param> /// <param name="header">The header.</param> /// <returns></returns> /// <exception cref="System.ArgumentNullException"></exception> public object Get(object tag, string name, IServiceCacheRegistration registration, out CacheItemHeader header) { if (registration == null) { throw new ArgumentNullException("registration"); } var version = (tag as DataCacheItemVersion); string regionName; if (!registration.UseHeaders) { header = null; } else if (version == null) { header = (CacheItemHeader)(!Settings.TryGetRegion(ref name, out regionName) ? Cache.Get(name + "#") : Cache.Get(name + "#", regionName)); } else { header = (CacheItemHeader)(!Settings.TryGetRegion(ref name, out regionName) ? Cache.GetIfNewer(name + "#", ref version) : Cache.GetIfNewer(name + "#", ref version, regionName)); } if (version == null) { return(!Settings.TryGetRegion(ref name, out regionName) ? Cache.Get(name) : Cache.Get(name, regionName)); } return(!Settings.TryGetRegion(ref name, out regionName) ? Cache.GetIfNewer(name, ref version) : Cache.GetIfNewer(name, ref version, regionName)); }
/// <summary> /// Gets the specified tag. /// </summary> /// <param name="tag">The tag.</param> /// <param name="name">The name.</param> /// <param name="registration">The registration.</param> /// <param name="header">The header.</param> /// <returns></returns> /// <exception cref="System.ArgumentNullException"></exception> public object Get(object tag, string name, IServiceCacheRegistration registration, out CacheItemHeader header) { if (registration == null) { throw new ArgumentNullException("registration"); } object value; header = (registration.UseHeaders && _cache.TryGetValue(name + "#", out value) ? (CacheItemHeader)value : null); return(_cache.TryGetValue(name, out value) ? value : null); }
/// <summary> /// Initializes a new instance of the <see cref="ServiceCacheByDispatcher" /> struct. /// </summary> /// <param name="registration">The registration.</param> /// <param name="values">The values.</param> /// <param name="header">The header.</param> public ServiceCacheByDispatcher(IServiceCacheRegistration registration, object[] values, CacheItemHeader header) { Registration = registration; Values = values; Header = header; }
/// <summary> /// Gets the specified tag. /// </summary> /// <param name="tag">The tag.</param> /// <param name="name">The name.</param> /// <param name="registration">The registration.</param> /// <param name="header">The header.</param> /// <returns></returns> /// <exception cref="System.ArgumentNullException"></exception> public object Get(object tag, string name, IServiceCacheRegistration registration, out CacheItemHeader header) { if (registration == null) { throw new ArgumentNullException("registration"); } string regionName; Settings.TryGetRegion(ref name, out regionName); header = (registration.UseHeaders ? (CacheItemHeader)Cache.Get(name + "#", regionName) : null); return(Cache.Get(name, regionName)); }