source: binary-improvements2/7dtd-server-fixes/src/FileCache/AbstractCache.cs@ 394

Last change on this file since 394 was 392, checked in by alloc, 2 years ago

Added command to invalidate file caches
Added a debug+profiling build target

File size: 678 bytes
RevLine 
[392]1using System.Collections.Generic;
2
[324]3namespace AllocsFixes.FileCache {
[325]4 public abstract class AbstractCache {
[351]5 public abstract byte[] GetFileContent (string _filename);
[392]6 public abstract (int, int) Invalidate ();
7
8 protected AbstractCache () {
9 caches.Add (this);
10 }
11
12 private static readonly List<AbstractCache> caches = new List<AbstractCache> ();
13 public static (int, int) InvalidateAllCaches () {
14 int filesDropped = 0;
15 int bytesDropped = 0;
16
17 foreach (AbstractCache cache in caches) {
18 (int, int) returned = cache.Invalidate ();
19 filesDropped += returned.Item1;
20 bytesDropped += returned.Item2;
21 }
22
23 return (filesDropped, bytesDropped);
24 }
[325]25 }
[324]26}
Note: See TracBrowser for help on using the repository browser.