private void WriteOutputStream(SoapMessage message)
        {
            this._NewStream.Position = 0;
            this._NewStream.CopyTo(this._OldStream);
            this._NewStream.Position = 0;

            ServiceMethodConfigurationElement methodSettings = GetMethodSettings(this._RequestMessage);

            if (message.Exception == null && this._RequestMessage.UseServerCache && methodSettings.CacheEnabled)
            {
                ServiceMethodCache methodCache = this.GetMethodCacheManager().GetOrAddNewValue(this._RequestMessage.MethodCacheKey, (cache, key) =>
                {
                    T result = this.CreateServiceMethodCache(this._RequestMessage.MethodCacheKey, methodSettings.QueueLength);

                    cache.Add(key, result);

                    return(result);
                });

                using (StreamReader reader = new StreamReader(this._NewStream))
                {
                    string dataInCache = reader.ReadToEnd();

                    methodCache.Add(this._RequestMessage.Document.OuterXml, dataInCache, CreateDependency(methodSettings));
                }
            }
        }
        private string GetDataInCache(SimpleRequestSoapMessage requestMessage)
        {
            string result = null;

            ServiceMethodCache methodCache = null;

            if (this.GetMethodCacheManager().TryGetValue(requestMessage.MethodCacheKey, out methodCache))
            {
                methodCache.TryGetValue(requestMessage.Document.OuterXml, out result);
            }

            return(result);
        }