@@ -20,39 +20,22 @@ namespace Csla.DataPortalClient
20
20
public interface IDataPortalCache
21
21
{
22
22
/// <summary>
23
- /// Try to get result from cache.
23
+ /// Get result from cache or data portal .
24
24
/// </summary>
25
25
/// <param name="objectType">Type of domain object to retrieve</param>
26
26
/// <param name="criteria">Criteria for domain type being retrieved</param>
27
27
/// <param name="operation">Data portal operation</param>
28
- /// <returns>null if not in cache</returns>
29
- Task < Server . DataPortalResult ? > GetDataPortalResultAsync ( Type objectType , object criteria , DataPortalOperations operation ) ;
30
- /// <summary>
31
- /// Add object to cache.
32
- /// </summary>
33
- /// <param name="objectType">Type of domain object to add</param>
34
- /// <param name="criteria">Criteria for domain type being added</param>
35
- /// <param name="operation">Data portal operation</param>
36
- /// <param name="result">Data portal result to cache</param>
37
- /// <returns></returns>
38
- Task AddDataPortalResultAsync ( Type objectType , object criteria , DataPortalOperations operation , Server . DataPortalResult result ) ;
39
- /// <summary>
40
- /// Gets a value indicating whether the domain type
41
- /// can be cached.
42
- /// </summary>
43
- /// <param name="objectType">Type of domain object to add</param>
44
- /// <param name="criteria">Criteria for domain type being added</param>
45
- /// <param name="operation">Data portal operation</param>
46
- /// <returns></returns>
47
- bool IsCacheable ( Type objectType , object criteria , DataPortalOperations operation ) ;
48
- /// <summary>
49
- /// Gets a semaphore used by the data portal to only allow a single
50
- /// consumer/thread to get/add an item to the cache at a time.
51
- /// </summary>
28
+ /// <param name="portal">Data portal delegate</param>
52
29
/// <remarks>
53
- /// This semaphore must be a `new SemaphoreSlim(1)`
30
+ /// The data portal invokes this method for each operation. The cache
31
+ /// implementation may choose to return a result from the cache,
32
+ /// or return a result by invoking the data portal delegate.
54
33
/// </remarks>
55
- SemaphoreSlim Semaphore { get ; }
34
+ Task < Server . DataPortalResult > GetDataPortalResultAsync (
35
+ Type objectType ,
36
+ object criteria ,
37
+ DataPortalOperations operation ,
38
+ Func < Task < Server . DataPortalResult > > portal ) ;
56
39
}
57
40
}
58
41
#nullable disable
0 commit comments