/// <summary> /// Evict an entry from the second-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="entityName">The name of the entity to evict.</param> /// <param name="id"></param> /// <param name="tenantIdentifier">Tenant identifier</param> public static void EvictEntity(this ISessionFactory factory, string entityName, object id, string tenantIdentifier) { if (tenantIdentifier == null) { factory.EvictEntity(entityName, id); } ReflectHelper.CastOrThrow <SessionFactoryImpl>(factory, "multi-tenancy").EvictEntity(entityName, id, tenantIdentifier); }
public static void ClearSecondLevelCache(ISessionFactory sessionFactory) { var classMetadata = sessionFactory.GetAllClassMetadata(); foreach (var ep in classMetadata.Values) { sessionFactory.EvictEntity(ep.EntityName); } var collMetadata = sessionFactory.GetAllCollectionMetadata(); foreach (var acp in collMetadata.Values) { sessionFactory.EvictCollection(acp.Role); } }
static void ClearCache(ISessionFactory factory) { factory.EvictQueries(); foreach (var collectionMetadata in factory.GetAllCollectionMetadata()) { factory.EvictCollection(collectionMetadata.Key); } foreach (var classMetadata in factory.GetAllClassMetadata()) { factory.EvictEntity(classMetadata.Key); } }
public static void ClearSecondLevelCache(ISessionFactory sessionFactory) { var classMetadata = sessionFactory.GetAllClassMetadata(); foreach (var ep in classMetadata.Values) { sessionFactory.EvictEntity(ep.EntityName); } var collMetadata = sessionFactory.GetAllCollectionMetadata(); foreach (var acp in collMetadata.Values) { sessionFactory.EvictCollection(acp.Role); } }
/// <summary> /// Evict all entries from the second-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="entityNames">The names of the entities to evict.</param> public static void EvictEntity(this ISessionFactory factory, IEnumerable <string> entityNames) { if (factory is SessionFactoryImpl sfi) { sfi.EvictEntity(entityNames); } else { if (entityNames == null) { throw new ArgumentNullException(nameof(entityNames)); } foreach (var name in entityNames) { factory.EvictEntity(name); } } }
public void EvictEntity(string entityName) => _inner.EvictEntity(entityName);
public void EvictEntity(string entityName) { _sessionFactory.EvictEntity(entityName); }
public void EvictEntity(string entityName) { _factory.EvictEntity(entityName); }