File tree Expand file tree Collapse file tree 6 files changed +93
-2
lines changed Expand file tree Collapse file tree 6 files changed +93
-2
lines changed Original file line number Diff line number Diff line change 1
1
namespace HttpClient . Cache ;
2
2
3
+ /// <summary>
4
+ /// Cache value holder
5
+ /// </summary>
3
6
public interface ICacheEntry : IDisposable
4
7
{
8
+ /// <summary>
9
+ /// Cache value
10
+ /// </summary>
5
11
object Value { get ; set ; }
6
12
13
+ /// <summary>
14
+ /// Cache entry priority
15
+ /// </summary>
16
+ CacheEntryPriority Priority { get ; set ; }
17
+
18
+ /// <summary>
19
+ /// Entry absolute expiration. The entry will be expired after a set amount of time
20
+ /// </summary>
7
21
DateTimeOffset ? AbsoluteExpiration { get ; set ; }
8
22
23
+ /// <summary>
24
+ /// Entry absolute expiration relative to created time. The entry will be expired a set amount of time from now
25
+ /// </summary>
9
26
TimeSpan ? AbsoluteExpirationRelativeToNow { get ; set ; }
10
27
28
+ /// <summary>
29
+ /// Entry sliding expiration. Entry will be expired if it hasn't been accessed in a set amount of time.
30
+ /// </summary>
11
31
TimeSpan ? SlidingExpiration { get ; set ; }
12
32
33
+ /// <summary>
34
+ /// Collection of <see cref="IChangeToken"/> tokens.
35
+ /// Any lifecycle changes will appear here
36
+ /// </summary>
13
37
IList < IChangeToken > ExpirationTokens { get ; }
14
38
39
+ /// <summary>
40
+ /// Collection of <see cref="PostEvictionCallbackRegistration"/> callbacks.
41
+ /// Will be executed on entry eviction
42
+ /// </summary>
15
43
IList < PostEvictionCallbackRegistration > PostEvictionCallbacks { get ; }
16
-
17
- CacheEntryPriority Priority { get ; set ; }
18
44
}
Original file line number Diff line number Diff line change 1
1
namespace HttpClient . Cache ;
2
2
3
+ /// <summary>
4
+ /// Cache keys generator
5
+ /// </summary>
3
6
public interface ICacheKeysProvider
4
7
{
8
+ /// <summary>
9
+ /// Generate a cache key for <see cref="HttpRequestMessage"/> http request
10
+ /// </summary>
11
+ /// <param name="request">Http request</param>
12
+ /// <returns>Cache key</returns>
5
13
string GetKey ( HttpRequestMessage request ) ;
6
14
}
Original file line number Diff line number Diff line change 1
1
namespace HttpClient . Cache ;
2
2
3
+ /// <summary>
4
+ /// Defines the mechanism for checking the changes over the cache entry
5
+ /// </summary>
3
6
public interface IChangeToken
4
7
{
8
+ /// <summary>
9
+ /// Cache entry is changed
10
+ /// </summary>
5
11
bool HasChanged { get ; }
6
12
13
+ /// <summary>
14
+ /// Call the callback on change
15
+ /// </summary>
7
16
bool ActiveChangeCallbacks { get ; }
8
17
18
+ /// <summary>
19
+ /// Register a callback to call on change
20
+ /// </summary>
21
+ /// <param name="callback">Callback to call</param>
22
+ /// <param name="state">Current state</param>
23
+ /// <returns><see cref="IDisposable"/> callback handler</returns>
9
24
IDisposable RegisterChangeCallback ( Action < object > callback , object state ) ;
10
25
}
Original file line number Diff line number Diff line change 1
1
namespace HttpClient . Cache . InMemory . Clock ;
2
2
3
+ /// <summary>
4
+ /// Defines cache clock
5
+ /// </summary>
3
6
public interface ISystemClock
4
7
{
8
+ /// <summary>
9
+ /// Current time
10
+ /// </summary>
5
11
DateTimeOffset UtcNow { get ; }
6
12
}
Original file line number Diff line number Diff line change 1
1
namespace HttpClient . Cache . InMemory ;
2
2
3
+ /// <summary>
4
+ /// Describes the API for InMemory cache
5
+ /// </summary>
3
6
public interface IMemoryCache : IDisposable
4
7
{
8
+ /// <summary>
9
+ /// Getting the cache value by key
10
+ /// </summary>
11
+ /// <param name="key">Entry key</param>
12
+ /// <param name="value">Cache value</param>
13
+ /// <returns>True if entry exist and returned, otherwise - false</returns>
5
14
bool TryGetValue ( object key , out object ? value ) ;
6
15
16
+ /// <summary>
17
+ /// Create empty cache entry
18
+ /// </summary>
19
+ /// <param name="key">Entry key</param>
20
+ /// <returns><see cref="ICacheEntry"/> cache entry</returns>
7
21
ICacheEntry CreateEntry ( object key ) ;
8
22
23
+ /// <summary>
24
+ /// Remove entry by key
25
+ /// </summary>
26
+ /// <param name="key">Entry key</param>
9
27
void Remove ( object key ) ;
10
28
29
+ /// <summary>
30
+ /// Clean the cache
31
+ /// </summary>
11
32
void Clear ( ) ;
12
33
}
Original file line number Diff line number Diff line change 2
2
3
3
namespace HttpClient . Cache . Stats ;
4
4
5
+ /// <summary>
6
+ /// Defines a mechanism to report cache hit/miss and generate on this info a cache report
7
+ /// </summary>
5
8
public interface ICacheStatsProvider
6
9
{
10
+ /// <summary>
11
+ /// Mark a cache hit
12
+ /// </summary>
13
+ /// <param name="code">Target code</param>
7
14
void ReportHit ( HttpStatusCode code ) ;
8
15
16
+ /// <summary>
17
+ /// Mark a cache miss
18
+ /// </summary>
19
+ /// <param name="code">Target code</param>
9
20
void ReportMiss ( HttpStatusCode code ) ;
10
21
22
+ /// <summary>
23
+ /// Gets stored cache report
24
+ /// </summary>
25
+ /// <returns><see cref="CacheStatsReport"/> report</returns>
11
26
CacheStatsReport GetReport ( ) ;
12
27
}
You can’t perform that action at this time.
0 commit comments