/** * Expires a type with specific identities from cache. * * <p>Objects expired from the cache will be read from persistent storage, as opposed to being * read from the performance cache, during subsequent load/query operations. * * <p>When objects are expired from the cache individually, by identity, objects contained within * a "master" object, for example objects maintained in a one-to-many relationship, will * automatically be expired from the cache, without the need to explicitly identify them. This * does not apply when expiring objects by type. Each type, both container and contained objects * need to be specified. * * <p> * * @param type The type to expire. * @param identity An array of object identifiers to expire. */ public void expireCache(final Class type, final Object[] identity) throws PersistenceException { testForOpenDatabase(); ClassMolder molder = _lockEngine.getClassMolder(type); for (int i = 0; i < identity.length; i++) { _transactionContext.expireCache(molder, new Identity(identity[i])); } }
/** * Indicates whether am instance of cls is currently cached. * * @param cls The class type. * @param identity The object identity. * @return True if the object is cached. * @throws PersistenceException If a problem occured resolving the object's cache membership. */ public boolean isCached(final Class cls, final Object identity) throws PersistenceException { if (_transactionContext != null && _transactionContext.isOpen()) { return _transactionContext.isCached( _lockEngine.getClassMolder(cls), cls, new Identity(identity)); } throw new PersistenceException("isCached() has to be called within an active transaction."); }
/** * {@inheritDoc} * * @see org.castor.persist.AbstractTransactionContext * #createConnection(org.exolab.castor.persist.LockEngine) */ protected Connection createConnection(final LockEngine engine) throws ConnectionFailedException { // Get a new connection from the engine. Since the engine has no // transaction association, we must do this sort of round trip. An attempt // to have the transaction association in the engine inflates the code size // in other places. try { return engine.getDatabaseContext().getConnectionFactory().createConnection(); } catch (SQLException ex) { throw new ConnectionFailedException(Messages.format("persist.nested", ex), ex); } }
/** * Expires all instances of specified types from cache. * * <p>Objects expired from the cache will be read from persistent storage, as opposed to being * read from the performance cache, during subsequent load/query operations. * * <p>When objects are expired from the cache individually, by identity, objects contained within * a "master" object, for example objects maintained in a one-to-many relationship, will * automatically be expired from the cache, without the need to explicitly identify them. This * does not apply when expiring objects by type. Each type, both container and contained objects * need to be specified. * * <p> * * @param type An array of types to expire. */ public void expireCache(final Class[] type) { for (int i = 0; i < type.length; i++) { _lockEngine.expireCache(type[i]); } }
/** * Expires all objects from cache. * * <p>Objects expired from the cache will be read from persistent storage, as opposed to being * read from the performance cache, during subsequent load/query operations. * * <p>When objects are expired from the cache individually, by identity, objects contained within * a "master" object, for example objects maintained in a one-to-many relationship, will * automatically be expired from the cache, without the need to explicitly identify them. This * does not apply when expiring objects by type. Each type, both container and contained objects * need to be specified. */ public void expireCache() { _lockEngine.expireCache(); }
/** Dump cached objects of specific type to log. */ public void dumpCache(final Class cls) { _lockEngine.dumpCache(cls); }
/** Dump all cached objects to log. */ public void dumpCache() { _lockEngine.dumpCache(); }