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); } }
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); } }