forked from PNNL-Comp-Mass-Spec/MASIC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
clsSpectrumCacheOptions.cs
68 lines (55 loc) · 2.07 KB
/
clsSpectrumCacheOptions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
using System;
namespace MASIC
{
public class clsSpectrumCacheOptions
{
#region "Properties"
/// <summary>
/// If True, then spectra will never be cached to disk and the spectra pool will consequently be increased as needed
/// </summary>
public bool DiskCachingAlwaysDisabled { get; set; }
/// <summary>
/// Path to the cache directory (can be relative or absolute, aka rooted); if empty, then the user's AppData directory is used
/// </summary>
public string DirectoryPath { get; set; }
/// <summary>
/// Number of spectra to keep in the in-memory cache
/// </summary>
public int SpectraToRetainInMemory
{
get => mSpectraToRetainInMemory;
set
{
if (value < 100)
value = 100;
mSpectraToRetainInMemory = value;
}
}
[Obsolete("Legacy parameter; no longer used")]
public float MinimumFreeMemoryMB { get; set; }
[Obsolete("Legacy parameter; no longer used")]
public float MaximumMemoryUsageMB { get; set; }
#endregion
#region "Classwide variables"
private int mSpectraToRetainInMemory = 1000;
#endregion
/// <summary>
/// Reset the options
/// </summary>
public void Reset()
{
var defaultOptions = clsSpectraCache.GetDefaultCacheOptions();
DiskCachingAlwaysDisabled = defaultOptions.DiskCachingAlwaysDisabled;
DirectoryPath = defaultOptions.DirectoryPath;
SpectraToRetainInMemory = defaultOptions.SpectraToRetainInMemory;
}
/// <summary>
/// Show the maximum number of spectra to cache, and the cache directory
/// </summary>
/// <returns></returns>
public override string ToString()
{
return "Cache up to " + SpectraToRetainInMemory + " in directory " + DirectoryPath;
}
}
}