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) }); }
public static void CloneALot2(RavenJToken jt) { RavenJToken temp; for (int i = 0; i < IterationsCount; i++) { temp = jt.CloneToken(); } }
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) }); }
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(); } }
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(); } }
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) }); }
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) }); }
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) }); }