コード例 #1
0
        /// <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));
        }
コード例 #2
0
 /// <summary>
 /// Tries the get value.
 /// </summary>
 /// <param name="registration">The registration.</param>
 /// <param name="recurses">The recurses.</param>
 /// <param name="foundRegistration">The found registration.</param>
 /// <returns></returns>
 public static bool TryGetValue(IServiceCacheRegistration registration, ref int recurses, out IServiceCacheRegistration foundRegistration)
 {
     _rwLock.EnterReadLock();
     try
     {
         var registrar = registration.Registrar;
         if (registrar != null)
         {
             // local check
             var foreignRegistration = (registration as ServiceCacheForeignRegistration);
             if (foreignRegistration == null)
             {
                 foundRegistration = registration;
                 return(true);
             }
             // foreign recurse
             if (recurses++ > 4)
             {
                 throw new InvalidOperationException(Local.ExceedRecurseCount);
             }
             // touch - starts foreign static constructor
             var foreignType = foreignRegistration.ForeignType;
             foreignType.InvokeMember("Touch", BindingFlags.InvokeMethod | BindingFlags.NonPublic | BindingFlags.Static, null, null, null);
             return(TryGetValue(foreignType, foreignRegistration.ForeignName, ref recurses, out foundRegistration));
         }
         foundRegistration = null;
         return(false);
     }
     finally { _rwLock.ExitReadLock(); }
 }
コード例 #3
0
 /// <summary>
 /// Registers the specified registration.
 /// </summary>
 /// <param name="registration">The registration.</param>
 public void Register(IServiceCacheRegistration registration)
 {
     if (registration == null)
     {
         throw new ArgumentNullException("registration");
     }
     _setRwLock.EnterWriteLock();
     try
     {
         if (_set.Contains(registration))
         {
             throw new InvalidOperationException(string.Format(Local.RedefineDataCacheAB, AnchorType.ToString(), registration.Name));
         }
         // add
         var registrationName = registration.Name;
         if (string.IsNullOrEmpty(registrationName))
         {
             throw new ArgumentNullException("registration.Name");
         }
         if (registrationName.IndexOf("::") > -1)
         {
             throw new ArgumentException(string.Format(Local.ScopeCharacterNotAllowedA, registrationName), "registration");
         }
         if (_setAsName.ContainsKey(registrationName))
         {
             throw new ArgumentException(string.Format(Local.RedefineNameA, registrationName), "registration");
         }
         _setAsName.Add(registrationName, registration);
         _set.Add(registration);
         // link-in
         registration.AttachRegistrar(this, _namePrefix + registrationName);
     }
     finally { _setRwLock.ExitWriteLock(); }
 }
コード例 #4
0
 /// <summary>
 /// Gets the specified registration.
 /// </summary>
 /// <param name="tag">The tag.</param>
 /// <param name="registration">The registration.</param>
 /// <returns></returns>
 /// <exception cref="System.ArgumentNullException"></exception>
 /// <exception cref="System.NotImplementedException"></exception>
 public IEnumerable <CacheItemHeader> Get(object tag, IServiceCacheRegistration registration)
 {
     if (registration == null)
     {
         throw new ArgumentNullException("registration");
     }
     throw new NotImplementedException();
 }
コード例 #5
0
 /// <summary>
 /// Removes from cache the item associated with the key provided.
 /// </summary>
 /// <param name="tag">The tag.</param>
 /// <param name="name">The name.</param>
 /// <param name="registration">The registration.</param>
 /// <returns>
 /// The item removed from the Cache. If the value in the key parameter is not found, returns null.
 /// </returns>
 public object Remove(object tag, string name, IServiceCacheRegistration registration)
 {
     if (registration != null && registration.UseHeaders)
     {
         Cache.Remove(name + "#");
     }
     return(Cache.Remove(name));
 }
コード例 #6
0
 /// <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));
 }
コード例 #7
0
        /// <summary>
        /// Removes from cache the item associated with the key provided.
        /// </summary>
        /// <param name="tag">The tag.</param>
        /// <param name="name">The name.</param>
        /// <param name="registration">The registration.</param>
        /// <returns>
        /// The item removed from the Cache. If the value in the key parameter is not found, returns null.
        /// </returns>
        public object Remove(object tag, string name, IServiceCacheRegistration registration)
        {
            string regionName;

            Settings.TryGetRegion(ref name, out regionName);
            if (registration != null && registration.UseHeaders)
            {
                Cache.Remove(name + "#", regionName);
            }
            return(Cache.Remove(name, regionName));
        }
コード例 #8
0
        /// <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);
        }
コード例 #9
0
        /// <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));
        }
コード例 #10
0
        /// <summary>
        /// Sends the specified cache.
        /// </summary>
        /// <param name="cache">The cache.</param>
        /// <param name="registration">The registration.</param>
        /// <param name="tag">The tag.</param>
        /// <param name="messages">The messages.</param>
        /// <exception cref="System.NotImplementedException"></exception>
        public void Send(IServiceCache cache, IServiceCacheRegistration registration, object tag, params object[] messages)
        {
            if (cache == null)
            {
                throw new ArgumentNullException("cache");
            }
            if (registration == null)
            {
                throw new ArgumentNullException("registration");
            }
            var registration2 = (registration as ServiceCacheRegistration);

            if (registration2 == null)
            {
                throw new ArgumentException("must be ServiceCacheRegistration", "registration");
            }
            var consumerInfos = registration2.GetConsumersFor(messages);

            if (!consumerInfos.GetEnumerator().MoveNext())
            {
                return;
            }
            //
            var itemPolicy = registration2.ItemPolicy;

            if (itemPolicy == null)
            {
                throw new ArgumentNullException("registration.ItemPolicy");
            }
            var    useDBNull = ((cache.Settings.Options & ServiceCacheOptions.UseDBNullWithRegistrations) == ServiceCacheOptions.UseDBNullWithRegistrations);
            var    distributedServiceCache = cache.BehaveAs <IDistributedServiceCache>();
            object value;

            foreach (var header in cache.Get(tag, registration))
            {
                foreach (var consumerInfo in consumerInfos)
                {
                    if ((value = consumerInfo.Invoke(cache, tag, header)) != null)
                    {
                        if (distributedServiceCache == null)
                        {
                            SetUsingLock(cache, registration2, tag, header, useDBNull, value);
                        }
                        else
                        {
                            SetUsingCas(distributedServiceCache, registration2, tag, header, useDBNull, value);
                        }
                    }
                }
            }
        }
コード例 #11
0
        /// <summary>
        /// Removes from cache the item associated with the key provided.
        /// </summary>
        /// <param name="tag">The tag.</param>
        /// <param name="name">The key.</param>
        /// <param name="registration">The registration.</param>
        /// <returns>
        /// The item removed from the Cache. If the value in the key parameter is not found, returns null.
        /// </returns>
        public object Remove(object tag, string name, IServiceCacheRegistration registration)
        {
            object value;

            if (_cache.TryGetValue(name, out value))
            {
                if (registration != null && registration.UseHeaders)
                {
                    _cache.Remove(name + "#");
                }
                _cache.Remove(name);
                return(value);
            }
            return(null);
        }
コード例 #12
0
        /// <summary>
        /// Removes from cache the item associated with the key provided.
        /// </summary>
        /// <param name="tag">The tag.</param>
        /// <param name="name">The name.</param>
        /// <param name="registration">The registration.</param>
        /// <returns>
        /// The item removed from the Cache. If the value in the key parameter is not found, returns null.
        /// </returns>
        public object Remove(object tag, string name, IServiceCacheRegistration registration)
        {
            if (registration != null && registration.UseHeaders)
            {
                Remove(tag, name + "#", null);
            }
            string regionName;
            var    value = ((Settings.Options & ServiceCacheOptions.ReturnsCachedValueOnRemove) == 0 ? null : (!Settings.TryGetRegion(ref name, out regionName) ? Cache.Get(name) : Cache.Get(name, regionName)));
            //
            var version    = (tag as DataCacheItemVersion);
            var lockHandle = (tag as DataCacheLockHandle);

            if (version == null && lockHandle == null)
            {
                if (!Settings.TryGetRegion(ref name, out regionName))
                {
                    Cache.Remove(name);
                }
                else
                {
                    Cache.Remove(name, regionName);
                }
            }
            else if (version != null)
            {
                if (!Settings.TryGetRegion(ref name, out regionName))
                {
                    Cache.Remove(name, version);
                }
                else
                {
                    Cache.Remove(name, version, regionName);
                }
            }
            else
            {
                if (!Settings.TryGetRegion(ref name, out regionName))
                {
                    Cache.Remove(name, lockHandle);
                }
                else
                {
                    Cache.Remove(name, lockHandle, regionName);
                }
            }
            return(value);
        }
コード例 #13
0
        /// <summary>
        /// Gets the specified cache.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="cache">The cache.</param>
        /// <param name="registration">The registration.</param>
        /// <param name="tag">The tag.</param>
        /// <param name="values">The values.</param>
        /// <returns></returns>
        public T Get <T>(IServiceCache cache, IServiceCacheRegistration registration, object tag, object[] values)
        {
            if (cache == null)
            {
                throw new ArgumentNullException("cache");
            }
            if (registration == null)
            {
                throw new ArgumentNullException("registration");
            }
            var registration2 = (registration as ServiceCacheRegistration);

            if (registration2 == null)
            {
                throw new ArgumentException("must be ServiceCacheRegistration", "registration");
            }
            var itemPolicy = registration2.ItemPolicy;

            if (itemPolicy == null)
            {
                throw new ArgumentNullException("registration.ItemPolicy");
            }
            // fetch from cache
            var    name = registration.AbsoluteName;
            string @namespace;

            if (values != null && values.Length > 0)
            {
                cache = cache.BehaveAs(values, out @namespace);
            }
            else
            {
                @namespace = null;
            }
            var useDBNull = ((cache.Settings.Options & ServiceCacheOptions.UseDBNullWithRegistrations) == ServiceCacheOptions.UseDBNullWithRegistrations);
            var distributedServiceCache = cache.BehaveAs <IDistributedServiceCache>();

            if (distributedServiceCache == null)
            {
                return(GetUsingLock <T>(cache, registration2, tag, values, name, @namespace, useDBNull));
            }
            return(GetUsingCas <T>(distributedServiceCache, registration2, tag, values, name, @namespace, useDBNull));
        }
コード例 #14
0
        /// <summary>
        /// Gets the specified registration.
        /// </summary>
        /// <param name="tag">The tag.</param>
        /// <param name="registration">The registration.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentNullException"></exception>
        public IEnumerable <CacheItemHeader> Get(object tag, IServiceCacheRegistration registration)
        {
            if (registration == null)
            {
                throw new ArgumentNullException("registration");
            }
            var             registrationName = registration.AbsoluteName + "#";
            CacheItemHeader value;
            var             e = Cache.GetEnumerator();

            while (e.MoveNext())
            {
                var key = (e.Key as string);
                if (key == null || !key.EndsWith(registrationName) || (value = (e.Value as CacheItemHeader)) == null)
                {
                    continue;
                }
                yield return(value);
            }
        }
コード例 #15
0
        //public void Update(IServiceCache cache, IServiceCacheRegistration registration, object tag, object value)
        //{
        //    if (cache == null)
        //        throw new ArgumentNullException("cache");
        //    if (registration == null)
        //        throw new ArgumentNullException("registration");
        //    var registration2 = (registration as ServiceCacheRegistration);
        //    if (registration2 == null)
        //        throw new ArgumentException("must be ServiceCacheRegistration", "registration");
        //    var itemPolicy = registration2.ItemPolicy;
        //    if (itemPolicy == null)
        //        throw new ArgumentNullException("registration.ItemPolicy");
        //    var useDBNull = ((cache.Settings.Options & ServiceCacheOptions.UseDBNullWithRegistrations) == ServiceCacheOptions.UseDBNullWithRegistrations);
        //    var distributedServiceCache = cache.BehaveAs<IDistributedServiceCache>();
        //    if (distributedServiceCache == null)
        //        SetUsingLock(cache, registration2, tag, header, useDBNull, value);
        //    else
        //        SetUsingCas(distributedServiceCache, registration2, tag, header, useDBNull, value);
        //}

        /// <summary>
        /// Removes the specified cache.
        /// </summary>
        /// <param name="cache">The cache.</param>
        /// <param name="registration">The registration.</param>
        public void Remove(IServiceCache cache, IServiceCacheRegistration registration)
        {
            if (cache == null)
            {
                throw new ArgumentNullException("cache");
            }
            if (registration == null)
            {
                throw new ArgumentNullException("registration");
            }
            var registration2 = (registration as ServiceCacheRegistration);

            if (registration2 == null)
            {
                throw new ArgumentException("must be ServiceCacheRegistration", "registration");
            }
            foreach (var name in registration2.Keys)
            {
                cache.Remove(null, name, registration);
            }
        }
コード例 #16
0
 /// <summary>
 /// Gets the specified registration.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="registration">The registration.</param>
 /// <returns></returns>
 public static T Get <T>(IServiceCacheRegistration registration)
 {
     return(ServiceCacheManager.Current.Get <T>(registration, null, null));
 }
コード例 #17
0
 /// <summary>
 /// Gets the many.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="registration">The registration.</param>
 /// <returns></returns>
 public static IEnumerable <T> GetMany <T>(IServiceCacheRegistration registration)
 {
     return(ServiceCacheManager.Current.Get <IEnumerable <T> >(registration, null, null));
 }
コード例 #18
0
 /// <summary>
 /// Gets the many.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="registration">The registration.</param>
 /// <param name="tag">The tag.</param>
 /// <param name="values">The values.</param>
 /// <returns></returns>
 public static IEnumerable <T> GetMany <T>(IServiceCacheRegistration registration, object tag, object[] values)
 {
     return(ServiceCacheManager.Current.Get <IEnumerable <T> >(registration, tag, values));
 }
コード例 #19
0
 /// <summary>
 /// Removes from cache the item associated with the key provided.
 /// </summary>
 /// <param name="tag">The tag.</param>
 /// <param name="name">The name.</param>
 /// <param name="registration">The registration.</param>
 /// <returns>
 /// The item removed from the Cache. If the value in the key parameter is not found, returns null.
 /// </returns>
 public object Remove(object tag, string name, IServiceCacheRegistration registration)
 {
     if (registration != null && registration.UseHeaders)
         Remove(tag, name + "#", null);
     string regionName;
     var value = ((Settings.Options & ServiceCacheOptions.ReturnsCachedValueOnRemove) == 0 ? null : (!Settings.TryGetRegion(ref name, out regionName) ? Cache.Get(name) : Cache.Get(name, regionName)));
     //
     var version = (tag as DataCacheItemVersion);
     var lockHandle = (tag as DataCacheLockHandle);
     if (version == null && lockHandle == null)
     {
         if (!Settings.TryGetRegion(ref name, out regionName)) Cache.Remove(name);
         else Cache.Remove(name, regionName);
     }
     else if (version != null)
     {
         if (!Settings.TryGetRegion(ref name, out regionName)) Cache.Remove(name, version);
         else Cache.Remove(name, version, regionName);
     }
     else
     {
         if (!Settings.TryGetRegion(ref name, out regionName)) Cache.Remove(name, lockHandle);
         else Cache.Remove(name, lockHandle, regionName);
     }
     return value;
 }
コード例 #20
0
 /// <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));
 }
コード例 #21
0
 /// <summary>
 /// Gets the specified registration.
 /// </summary>
 /// <param name="tag">The tag.</param>
 /// <param name="registration">The registration.</param>
 /// <returns></returns>
 /// <exception cref="System.ArgumentNullException"></exception>
 public IEnumerable<CacheItemHeader> Get(object tag, IServiceCacheRegistration registration)
 {
     if (registration == null)
         throw new ArgumentNullException("registration");
     var registrationName = registration.AbsoluteName + "#";
     CacheItemHeader value;
     var e = Cache.GetEnumerator();
     while (e.MoveNext())
     {
         var key = (e.Key as string);
         if (key == null || !key.EndsWith(registrationName) || (value = (e.Value as CacheItemHeader)) == null)
             continue;
         yield return value;
     }
 }
 public IEnumerable <CacheItemHeader> Get(object tag, IServiceCacheRegistration registration)
 {
     return(_parent.Get(tag, registration));
 }
コード例 #23
0
 /// <summary>
 /// Removes from cache the item associated with the key provided.
 /// </summary>
 /// <param name="tag">The tag.</param>
 /// <param name="name">The name.</param>
 /// <param name="registration">The registration.</param>
 /// <returns>
 /// The item removed from the Cache. If the value in the key parameter is not found, returns null.
 /// </returns>
 public object Remove(object tag, string name, IServiceCacheRegistration registration)
 {
     throw new NotSupportedException();
 }
コード例 #24
0
 /// <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");
     throw new NotImplementedException();
 }
 public object Remove(object tag, string name, IServiceCacheRegistration registration)
 {
     return(_parent.Remove(tag, _namespace + name, registration));
 }
コード例 #26
0
 /// <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);
 }
コード例 #27
0
 /// <summary>
 /// Removes the specified registration.
 /// </summary>
 /// <param name="registration">The registration.</param>
 /// <returns></returns>
 public bool Remove(IServiceCacheRegistration registration)
 {
     _setRwLock.EnterWriteLock();
     try { _setAsName.Remove(registration.Name); return(_set.Remove(registration)); }
     finally { _setRwLock.ExitWriteLock(); }
 }
コード例 #28
0
 /// <summary>
 /// Removes from cache the item associated with the key provided.
 /// </summary>
 /// <param name="tag">The tag.</param>
 /// <param name="name">The name.</param>
 /// <param name="registration">The registration.</param>
 /// <returns>
 /// The item removed from the Cache. If the value in the key parameter is not found, returns null.
 /// </returns>
 public object Remove(object tag, string name, IServiceCacheRegistration registration)
 {
     if (registration != null && registration.UseHeaders) Cache.Remove(name + "#"); return Cache.Remove(name);
 }
コード例 #29
0
 /// <summary>
 /// Gets the specified registration.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="registration">The registration.</param>
 /// <param name="tag">The tag.</param>
 /// <param name="values">The values.</param>
 /// <returns></returns>
 public static T Get <T>(IServiceCacheRegistration registration, object tag, object[] values)
 {
     return(ServiceCacheManager.Current.Get <T>(registration, tag, values));
 }
コード例 #30
0
 /// <summary>
 /// Gets the specified registration.
 /// </summary>
 /// <param name="tag">The tag.</param>
 /// <param name="registration">The registration.</param>
 /// <returns></returns>
 /// <exception cref="System.ArgumentNullException"></exception>
 /// <exception cref="System.NotImplementedException"></exception>
 public IEnumerable<CacheItemHeader> Get(object tag, IServiceCacheRegistration registration)
 {
     if (registration == null)
         throw new ArgumentNullException("registration");
     throw new NotImplementedException();
 }
コード例 #31
0
 /// <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;
 }
コード例 #32
0
 /// <summary>
 /// Gets the query.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="registration">The registration.</param>
 /// <param name="tag">The tag.</param>
 /// <returns></returns>
 public static IQueryable <T> GetQuery <T>(IServiceCacheRegistration registration, object tag)
 {
     return(ServiceCacheManager.Current.Get <IQueryable <T> >(registration, tag, null));
 }
コード例 #33
0
 /// <summary>
 /// Gets the specified cached item.
 /// </summary>
 /// <param name="registration">The registration.</param>
 /// <returns></returns>
 public static object Get(IServiceCacheRegistration registration)
 {
     return(ServiceCacheManager.Current.Get <object>(registration, null, null));
 }
コード例 #34
0
 /// <summary>
 /// Determines whether the specified key contains key.
 /// </summary>
 /// <param name="registration">The registration.</param>
 /// <returns>
 ///   <c>true</c> if the specified key contains key; otherwise, <c>false</c>.
 /// </returns>
 public bool Contains(IServiceCacheRegistration registration)
 {
     _setRwLock.EnterReadLock();
     try { return(_set.Contains(registration)); }
     finally { _setRwLock.ExitReadLock(); }
 }
 public object Get(object tag, string name, IServiceCacheRegistration registration, out CacheItemHeader header)
 {
     return(_parent.Get(tag, _namespace + name, registration, out header));
 }