/** * Removes the invalidated item. */ public void release(Object key, SoftLock lock) throws CacheException { cache.remove(key); }
/** * @return the region name, which is the cache name in ehcache */ @Override public final String toString() { return "EHCache(" + getRegionName() + ')'; }
private void decrementLock(Object key, Lock lock) { lock.unlock(cache.nextTimestamp()); cache.update(key, lock); }
/** * {@inheritDoc} */ public EntityRegion buildEntityRegion(String regionName, Properties properties, CacheDataDescription metadata) throws CacheException { return new EhcacheEntityRegion(accessStrategyFactory, getCache(regionName), settings, metadata, properties); }
private void writeLock(Object key) { if (cache.canLockEntries()) { cache.lock(key); } else { coarseWriteLock.lock(); } }
private void writeUnlock(Object key) { if (cache.canLockEntries()) { cache.unlock(key); } else { coarseWriteLock.unlock(); } }
/** * {@inheritDoc} */ public Object get(Object key, long txTimestamp) throws CacheException { return cache.get(key); }
/** * Inserts the specified item into the cache. */ public boolean afterInsert(Object key, Object value, Object version) throws CacheException { cache.update(key, value); return true; }
/** * {@inheritDoc} */ public TransactionManager getTransactionManager(Properties properties) throws HibernateException { return getTransactionManager(); }
/** * {@inheritDoc} */ public final void clear() throws CacheException { cache.clear(); }
/** * Updates an object in the cache, or if it does not exist, inserts it. * * @param key an Object key * @param value an Object value * @throws CacheException if the {@link net.sf.ehcache.CacheManager} is shutdown or another {@link Exception} occurs. */ public final void update(Object key, Object value) throws CacheException { put(key, value); }
/** * {@inheritDoc} */ public final void destroy() { try { cache.destroy(); } catch (Exception e) { LOG.warn("could not destroy cache", e); } } }
private void readLockIfCoarse(Object key) { if (!cache.canLockEntries()) { coarseReadLock.lock(); } }
/** * Removes the stale item. */ public void evict(Object key) throws CacheException { cache.remove(key); }
/** * Gets an object from the cache. * * @param key an Object value * @return the Object, or null if not found * @throws CacheException */ public final Object read(Object key) throws CacheException { return get(key); }
/** * {@inheritDoc} */ public final String getRegionName() { return cache.getRegionName(); }
/** * {@inheritDoc} */ public final void remove(Object key) throws CacheException { cache.remove(key); }
/** * {@inheritDoc} */ public Object get(Object key, long timestamp) throws CacheException { return cache.get(key); }