// Cache_Free // // Frees the memory and removes it from the LRU list private static void Free(cache_user_t c) { if (c.data == null) { Sys.Error("Cache_Free: not allocated"); } CacheEntry entry = (CacheEntry)c; entry.Remove(); }
// Cache_Check /// <summary> /// Cache_Check /// Returns value of c.data if still cached or null /// </summary> public static object Check(cache_user_t c) { CacheEntry cs = (CacheEntry)c; if (cs == null || cs.data == null) { return(null); } // move to head of LRU cs.RemoveFromLRU(); cs.LRUInstertAfter(_Head); return(cs.data); }