コード例 #1
0
        public async Task DeleteProfileAsync(string name)        //maps to DeleteQueryAsync
        {
            // Ensure QueriesDocument exists
            await GetDocumentAsync();

            // Load the currently saved object otherwise it would create a new document
            // as the new session is not tracking the cached object.
            // TODO: Solve by having an Import method in Session or an Id on the document

            var existing = await _session.Query <AssesmentProfilesDocument>().FirstOrDefaultAsync();

            if (existing.Profiles.ContainsKey(name))
            {
                existing.Profiles.Remove(name);
            }

            _session.Save(existing);

            _memoryCache.Set(AssesmentProfilesDocumentCacheKey, existing);
            await _signal.SignalTokenAsync(AssesmentProfilesDocumentCacheKey);
        }
コード例 #2
0
ファイル: IAvatarService.cs プロジェクト: nickaynes/test789
 public async Task InvalidateCachedUserAvatar(string username)
 {
     var memoryCacheKey = $"{AvatarCacheKeyPrefix}-{username}";
     await _signal.SignalTokenAsync(memoryCacheKey);
 }