示例#1
0
 public void DeclareDomain(DomainDescription domain)
 {
     try
     {
         Parallel.ForEach(CacheClients, client => client.DeclareDomain(domain));
     }
     catch (AggregateException e)
     {
         if (e.InnerException != null)
         {
             throw e.InnerException;
         }
     }
 }
示例#2
0
        /// <summary>
        ///     Declare a subset of data as being fully available in the cache.<br />
        ///     Used by loader components to declare data preloaded in the cache.
        ///     <seealso cref="DomainDescription" /> <seealso cref="DomainDeclarationAction" />
        /// </summary>
        /// <param name="domain">data description</param>
        /// <param name="action">add to, remove from or replace current data description</param>
        public void DeclareDomain(DomainDescription domain, DomainDeclarationAction action)
        {
            if (domain == null)
            {
                throw new ArgumentNullException(nameof(domain));
            }

            var request  = new DomainDeclarationRequest(domain, action);
            var response = Channel.SendRequest(request);

            if (response is ExceptionResponse exResponse)
            {
                throw new CacheException("Error while declaring a domain", exResponse.Message, exResponse.CallStack);
            }
        }