Example #1
0
 private async Task RemoveCustomIndicesAsync(T entity)
 {
     if (CustomIndices.Count < 1)
     {
         return;
     }
     foreach (var kvp in CustomIndices.Select(customIndex => customIndex(entity)))
     {
         var primaryEntityId = PrimaryEntityId(entity);
         var primaryCacheKey = ComposePrimaryCacheKey(primaryEntityId);
         await _appCache.RemoveFromCustomIndexAsync(kvp.Key, kvp.Value, primaryCacheKey, ComposePartitionName()).ConfigureAwait(false);
     }
 }
Example #2
0
 private async Task AddOrUpdateCustomIndicesAsync(T entity)
 {
     if (CustomIndices.Count < 1)
     {
         return;
     }
     foreach (var kvp in CustomIndices.Select(customIndex => customIndex(entity)))
     {
         var primaryEntityId = PrimaryEntityId(entity);
         var primaryCacheKey = ComposePrimaryCacheKey(primaryEntityId);
         if (string.IsNullOrEmpty(kvp.Key) || string.IsNullOrEmpty(kvp.Value))
         {
             continue;
         }
         await _appCache.AddOrUpdateItemOnCustomIndexAsync(kvp.Key, kvp.Value, primaryCacheKey, ComposePartitionName()).ConfigureAwait(false);
     }
 }