/// <summary> /// Modify the configuration of the window cache. /// <para /> /// The new configuration is applied immediately. If the new limits are /// smaller than what what is currently cached, older entries will be purged /// as soon as possible to allow the cache to meet the new limit. /// </summary> /// <param name="cfg"> /// The new window cache configuration. /// </param> public static void reconfigure(WindowCacheConfig cfg) { var newCache = new WindowCache(cfg); WindowCache oldCache = _cache; if (oldCache != null) { oldCache.removeAll(); } _cache = newCache; UnpackedObjectCache.Reconfigure(cfg); }
public static ByteWindow get(PackFile pack, long offset) { WindowCache c = _cache; ByteWindow r = c.getOrLoad(pack, c.ToStart(offset)); if (c != _cache) { // The cache was reconfigured while we were using the old one // to load this window. The window is still valid, but our // cache may think its still live. Ensure the window is removed // from the old cache so resources can be released. // c.removeAll(); } return(r); }