コード例 #1
0
        /// <summary>
        /// Evict an entry from the process-level cache.  This method occurs outside
        /// of any transaction; it performs an immediate "hard" remove, so does not respect
        /// any transaction isolation semantics of the usage strategy.  Use with care.
        /// </summary>
        /// <param name="factory">The session factory.</param>
        /// <param name="roleName">Collection role name.</param>
        /// <param name="id">Collection id</param>
        /// <param name="tenantIdentifier">Tenant identifier</param>
        /// <param name="cancellationToken">A cancellation token that can be used to cancel the work</param>
        public static async Task EvictCollectionAsync(this ISessionFactory factory, string roleName, object id, string tenantIdentifier, CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.ThrowIfCancellationRequested();
            if (tenantIdentifier == null)
            {
                await(factory.EvictCollectionAsync(roleName, id, cancellationToken)).ConfigureAwait(false);
            }

            await(ReflectHelper.CastOrThrow <SessionFactoryImpl>(factory, "multi-tenancy").EvictCollectionAsync(roleName, id, tenantIdentifier, cancellationToken)).ConfigureAwait(false);
        }
コード例 #2
0
 /// <summary>
 /// Evict all entries from the process-level cache. This method occurs outside
 /// of any transaction; it performs an immediate "hard" remove, so does not respect
 /// any transaction isolation semantics of the usage strategy. Use with care.
 /// </summary>
 /// <param name="factory">The session factory.</param>
 /// <param name="roleNames">The names of the collections to evict.</param>
 /// <param name="cancellationToken">A cancellation token that can be used to cancel the work</param>
 public static async Task EvictCollectionAsync(this ISessionFactory factory, IEnumerable <string> roleNames, CancellationToken cancellationToken = default(CancellationToken))
 {
     cancellationToken.ThrowIfCancellationRequested();
     if (factory is SessionFactoryImpl sfi)
     {
         await(sfi.EvictCollectionAsync(roleNames, cancellationToken)).ConfigureAwait(false);
     }
     else
     {
         if (roleNames == null)
         {
             throw new ArgumentNullException(nameof(roleNames));
         }
         foreach (var role in roleNames)
         {
             await(factory.EvictCollectionAsync(role, cancellationToken)).ConfigureAwait(false);
         }
     }
 }
コード例 #3
0
 public Task EvictCollectionAsync(string roleName, CancellationToken cancellationToken = new CancellationToken()) =>
 _inner.EvictCollectionAsync(roleName, cancellationToken);
コード例 #4
0
 public Task EvictCollectionAsync(string roleName, CancellationToken cancellationToken = new CancellationToken())
 {
     return(_sessionFactory.EvictCollectionAsync(roleName, cancellationToken));
 }