예제 #1
0
        internal void CacheResponse(string url, RavenJToken data, NameValueCollection headers)
        {
            if (string.IsNullOrEmpty(headers["ETag"]))
            {
                return;
            }

            RavenJToken clone;

            if (data == null)
            {
                clone = null;
            }
            else
            {
                clone = data.CloneToken();
                clone.EnsureCannotBeChangeAndEnableSnapshotting();
            }

            cache.Set(url, new CachedRequest
            {
                Data     = clone,
                Time     = SystemTime.UtcNow,
                Headers  = new NameValueCollection(headers),
                Database = MultiDatabase.GetDatabaseName(url)
            });
        }
예제 #2
0
        public static void CloneALot2(RavenJToken jt)
        {
            RavenJToken temp;

            for (int i = 0; i < IterationsCount; i++)
            {
                temp = jt.CloneToken();
            }
        }
예제 #3
0
        internal void CacheResponse(string url, RavenJToken data, NameValueCollection headers)
        {
            if (string.IsNullOrEmpty(headers["ETag"]))
            {
                return;
            }

            var clone = data.CloneToken();

            clone.EnsureSnapshot();
            cache.Set(url, new CachedRequest
            {
                Data    = clone,
                Time    = DateTimeOffset.Now,
                Headers = new NameValueCollection(headers)
            });
        }
예제 #4
0
		public static RavenJToken Clone(RavenJToken token)
		{
			switch (token.Type)
			{
				case JTokenType.Object:
				case JTokenType.Array:
				case JTokenType.Integer:
				case JTokenType.Float:
				case JTokenType.String:
				case JTokenType.Boolean:
				case JTokenType.Date:
				case JTokenType.Null:
				case JTokenType.Bytes:
					return token.CloneToken();
				default:
					throw new ArgumentOutOfRangeException();
			}
		}
예제 #5
0
        internal void CacheResponse(string url, RavenJToken data, HttpResponseHeaders headers)
        {
            if (headers.ETag == null || string.IsNullOrEmpty(headers.ETag.Tag))
            {
                return;
            }

            var clone = data.CloneToken();

            clone.EnsureCannotBeChangeAndEnableSnapshotting();

            cache.Set(url, new CachedRequest
            {
                Data     = clone,
                Time     = SystemTime.UtcNow,
                Headers  = new NameValueCollection(),               // TODO: Use headers
                Database = MultiDatabase.GetDatabaseName(url)
            });
        }
        public static RavenJToken Clone(RavenJToken token)
        {
            switch (token.Type)
            {
            case JTokenType.Object:
            case JTokenType.Array:
            case JTokenType.Integer:
            case JTokenType.Float:
            case JTokenType.String:
            case JTokenType.Boolean:
            case JTokenType.Date:
            case JTokenType.Null:
            case JTokenType.Bytes:
                return(token.CloneToken());

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
예제 #7
0
        internal void CacheResponse(string url, RavenJToken data, HttpResponseHeaders headers)
        {
            if (headers.ETag == null || string.IsNullOrEmpty(headers.ETag.Tag))
                return;

            var clone = data.CloneToken();
            clone.EnsureCannotBeChangeAndEnableSnapshotting();

            cache.Set(url, new CachedRequest
            {
                Data = clone,
                Time = SystemTime.UtcNow,
                Headers = new NameValueCollection(),// TODO: Use headers
                Database = MultiDatabase.GetDatabaseName(url)
            });
        }
예제 #8
0
        internal void CacheResponse(string url, RavenJToken data, NameValueCollection headers)
        {
            if (string.IsNullOrEmpty(headers[Constants.MetadataEtagField]))
                return;

            RavenJToken clone;
            if (data == null)
            {
                clone = null;
            }
            else
            {
                clone = data.CloneToken();
                clone.EnsureCannotBeChangeAndEnableSnapshotting();
            }

            cache.Set(url, new CachedRequest
            {
                Data = clone,
                Time = SystemTime.UtcNow,
                Headers = new NameValueCollection(headers),
                Database = MultiDatabase.GetDatabaseName(url)
            });
        }
예제 #9
0
		internal void CacheResponse(string url, RavenJToken data, NameValueCollection headers)
		{
			if (string.IsNullOrEmpty(headers["ETag"])) 
				return;

			var clone = data.CloneToken();
			clone.EnsureCannotBeChangeAndEnableSnapshotting();
			cache.Set(url, new CachedRequest
			{
				Data = clone,
				Time = DateTimeOffset.Now,
				Headers = new NameValueCollection(headers)
			});
		}