55
66namespace Microsoft . AspNet . OutputCache . CustomOutputCacheProvider {
77
8- public class CustomOutputCacheItem {
8+ internal class CustomOutputCacheItem {
99 public object Obj ;
1010 public DateTime UtcExpiry ;
11-
1211 public CustomOutputCacheItem ( object entry , DateTime utcExpiryIn ) {
1312 Obj = entry ;
1413 UtcExpiry = utcExpiryIn ;
1514 }
1615 }
1716
17+ /// <summary>
18+ /// This is just a proof of concept Async OutputCache Provider. It is used for testing purpose.
19+ /// </summary>
1820 public class CustomOutputCacheProvider : OutputCacheProviderAsync {
1921
2022 private readonly Dictionary < string , CustomOutputCacheItem > _dict ;
2123
24+ /// <summary>
25+ /// Async OutputCache Provider
26+ /// </summary>
2227 public CustomOutputCacheProvider ( ) {
2328 _dict = new Dictionary < string , CustomOutputCacheItem > ( ) ;
2429 }
@@ -27,6 +32,11 @@ private static async Task FooAsync() {
2732 await Task . Delay ( 1 ) ;
2833 }
2934
35+ /// <summary>
36+ /// Override method for the Async OutputCache Provider
37+ /// </summary>
38+ /// <param name="key"></param>
39+ /// <returns></returns>
3040 public override async Task < object > GetAsync ( string key ) {
3141 await FooAsync ( ) ;
3242 if ( ! _dict . ContainsKey ( key ) ) {
@@ -40,6 +50,13 @@ public override async Task<object> GetAsync(string key) {
4050 }
4151
4252
53+ /// <summary>
54+ /// Override method for the Async OutputCache Provider
55+ /// </summary>
56+ /// <param name="key"></param>
57+ /// <param name="entry"></param>
58+ /// <param name="utcExpiry"></param>
59+ /// <returns></returns>
4360 public override async Task < object > AddAsync ( string key , object entry , DateTime utcExpiry ) {
4461 await FooAsync ( ) ;
4562 if ( _dict . ContainsKey ( key ) && _dict [ key ] . UtcExpiry > DateTime . Now . ToUniversalTime ( ) ) {
@@ -54,6 +71,13 @@ public override async Task<object> AddAsync(string key, object entry, DateTime u
5471 return entry ;
5572 }
5673
74+ /// <summary>
75+ /// Override method for the Async OutputCache Provider
76+ /// </summary>
77+ /// <param name="key"></param>
78+ /// <param name="entry"></param>
79+ /// <param name="utcExpiry"></param>
80+ /// <returns></returns>
5781 public override async Task SetAsync ( string key , object entry , DateTime utcExpiry ) {
5882 await FooAsync ( ) ;
5983 if ( _dict . ContainsKey ( key ) ) {
@@ -64,11 +88,21 @@ public override async Task SetAsync(string key, object entry, DateTime utcExpiry
6488 }
6589 }
6690
91+ /// <summary>
92+ /// Override method for the Async OutputCache Provider
93+ /// </summary>
94+ /// <param name="key"></param>
95+ /// <returns></returns>
6796 public override async Task RemoveAsync ( string key ) {
6897 await FooAsync ( ) ;
6998 _dict . Remove ( key ) ;
7099 }
71100
101+ /// <summary>
102+ /// Override method for the Async OutputCache Provider
103+ /// </summary>
104+ /// <param name="key"></param>
105+ /// <returns></returns>
72106 public override object Get ( string key ) {
73107 if ( ! _dict . ContainsKey ( key ) ) {
74108 return null ;
@@ -80,6 +114,13 @@ public override object Get(string key) {
80114 return null ;
81115 }
82116
117+ /// <summary>
118+ /// Override method for the Async OutputCache Provider
119+ /// </summary>
120+ /// <param name="key"></param>
121+ /// <param name="entry"></param>
122+ /// <param name="utcExpiry"></param>
123+ /// <returns></returns>
83124 public override object Add ( string key , object entry , DateTime utcExpiry ) {
84125 if ( _dict . ContainsKey ( key ) && _dict [ key ] . UtcExpiry > DateTime . Now . ToUniversalTime ( ) ) {
85126 return _dict [ key ] . Obj ;
@@ -93,6 +134,12 @@ public override object Add(string key, object entry, DateTime utcExpiry) {
93134 return entry ;
94135 }
95136
137+ /// <summary>
138+ /// Override method for the Async OutputCache Provider
139+ /// </summary>
140+ /// <param name="key"></param>
141+ /// <param name="entry"></param>
142+ /// <param name="utcExpiry"></param>
96143 public override void Set ( string key , object entry , DateTime utcExpiry ) {
97144 if ( _dict . ContainsKey ( key ) ) {
98145 _dict [ key ] = new CustomOutputCacheItem ( entry , utcExpiry ) ;
@@ -102,6 +149,10 @@ public override void Set(string key, object entry, DateTime utcExpiry) {
102149 }
103150 }
104151
152+ /// <summary>
153+ /// Override method for the Async OutputCache Provider
154+ /// </summary>
155+ /// <param name="key"></param>
105156 public override void Remove ( string key ) {
106157 _dict . Remove ( key ) ;
107158 }
0 commit comments