Last change
on this file since 402 was 402, checked in by alloc, 22 months ago |
- Major refactoring
- Using Utf8Json for (de)serialization
- Moving APIs to REST
- Removing dependencies from WebServer and MapRenderer to ServerFixes
|
File size:
687 bytes
|
Rev | Line | |
---|
[392] | 1 | using System.Collections.Generic;
|
---|
| 2 |
|
---|
[402] | 3 | namespace Webserver.FileCache {
|
---|
[325] | 4 | public abstract class AbstractCache {
|
---|
[351] | 5 | public abstract byte[] GetFileContent (string _filename);
|
---|
[402] | 6 | public abstract (int filesDropped, int bytesDropped) Invalidate ();
|
---|
[392] | 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) {
|
---|
[402] | 18 | (int files, int bytes) = cache.Invalidate ();
|
---|
| 19 | filesDropped += files;
|
---|
| 20 | bytesDropped += bytes;
|
---|
[392] | 21 | }
|
---|
| 22 |
|
---|
| 23 | return (filesDropped, bytesDropped);
|
---|
| 24 | }
|
---|
[325] | 25 | }
|
---|
[324] | 26 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.