/// <summary> /// Returns the JObject of the page if we have it. /// </summary> private JObject GetEntityFromPage(Uri entity) { JObject result = null; if (Utility.IsRootUri(entity)) { JsonLdPage matchingPage = null; if (_pages.TryGetValue(entity, out matchingPage)) { matchingPage.UpdateLastUsed(); result = matchingPage.Compacted; } } return(result); }
/// <summary> /// True if the page has been added to the cache. /// </summary> public bool HasPageOfEntity(Uri entity) { bool result = false; Uri uri = Utility.GetUriWithoutHash(entity); JsonLdPage page = null; if (_pages.TryGetValue(uri, out page)) { // make the page as accessed so it stays around page.UpdateLastUsed(); result = !page.IsDisposed; // to be extra safe } return(result); }
/// <summary> /// Called by JsonLdPage after the graph has loaded. /// </summary> private void AddCallback(JsonLdPage page) { page.UpdateLastUsed(); MergeGraph(page.Graph); }