public async ValueTask SetAsync <T>(string cacheKey, CacheEntry <T> cacheEntry)
        {
            await TryConfigureIndexes();

            var command = new SetCommand(new DbCachedEntry
            {
                CacheKey = cacheKey,
                Expiry   = cacheEntry.Expiry,
                Value    = cacheEntry.Value
            });

            await EntityCommandWriter.WriteAsync <DbCachedEntry>(Connection, new[] { command }, default);
        }
 private static void InternalSaveChanges <TEntity>(IMongoDbConnection connection, IEnumerable <IWriteCommand> commands, WriteModelOptions options) where TEntity : class
 {
     EntityIndexWriter.ApplyIndexing <TEntity>(connection);
     EntityCommandWriter.Write <TEntity>(connection, commands, options);
 }
        private static async Task InternalSaveChangesAsync <TEntity>(IMongoDbConnection connection, IEnumerable <IWriteCommand> commands, WriteModelOptions options, CancellationToken cancellationToken) where TEntity : class
        {
            await EntityIndexWriter.ApplyIndexingAsync <TEntity>(connection);

            await EntityCommandWriter.WriteAsync <TEntity>(connection, commands, options, cancellationToken);
        }
Exemple #4
0
 /// <inheritdoc/>
 public async ValueTask FlushAsync()
 {
     await EntityCommandWriter.WriteAsync <DbCachedEntry>(Connection, new[] { new FlushCommand() }, default);
 }
Exemple #5
0
        /// <inheritdoc/>
        public async ValueTask EvictAsync(string cacheKey)
        {
            await TryConfigureIndexes();

            await EntityCommandWriter.WriteAsync <DbCachedEntry>(Connection, new[] { new EvictCommand(cacheKey) }, default);
        }
Exemple #6
0
        /// <inheritdoc/>
        public async ValueTask CleanupAsync()
        {
            await TryConfigureIndexes();

            await EntityCommandWriter.WriteAsync <DbCachedEntry>(Connection, new[] { new CleanupCommand() }, default);
        }