-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathISetAssociativeCache.cs
46 lines (41 loc) · 1.79 KB
/
ISetAssociativeCache.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
using System.Collections.Generic;
namespace ParksComputing.SetAssociativeCache {
/// <summary>
/// Represents a generic set-associative cache of key/value pairs.
/// </summary>
/// <typeparam name="TKey">The type of keys in the cache.</typeparam>
/// <typeparam name="TValue">The type of values in the cache.</typeparam>
public interface ISetAssociativeCache<TKey, TValue> : IDictionary<TKey, TValue> {
/// <summary>
/// Gets the capacity of the cache
/// </summary>
/// <value>
/// The number of elements which may be stored in the cache.
/// </value>
int Capacity { get; }
/// <summary>
/// Gets the number of sets in the cache
/// </summary>
/// <value>
/// The number of sets in the cache
/// </value>
int Sets { get; }
/// <summary>
/// Gets the capacity in each set
/// </summary>
/// <value>
/// The number of elements which may be stored in a set.
/// </value>
int Ways { get; }
/// <summary>
/// If the given <paramref name="key"/> would cause an existing key to be evicted, return <c>true</c> and set
/// <paramref name="evictKey"/> to the key of the item that would be evicted if the new <paramref name="key"/>
/// were added.
/// </summary>
/// <param name="key">Key to test.</param>
/// <param name="evictKey">Key of cache item that would be evicted, or default key value if return is false.</param>
/// <returns><c>true</c> if a key would be evicted; <c>false</c> otherwise.</returns>
/// <exception cref="System.ArgumentNullException"><paramref name="key"/> is null.</exception>
bool TryGetEvictKey(TKey key, out TKey evictKey);
}
}