Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/**
* Copyright Terracotta, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.sf.ehcache;
import java.beans.PropertyChangeListener;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
import net.sf.ehcache.bootstrap.BootstrapCacheLoader;
import net.sf.ehcache.config.CacheConfiguration;
import net.sf.ehcache.config.NonstopConfiguration;
import net.sf.ehcache.event.RegisteredEventListeners;
import net.sf.ehcache.exceptionhandler.CacheExceptionHandler;
import net.sf.ehcache.extension.CacheExtension;
import net.sf.ehcache.loader.CacheLoader;
import net.sf.ehcache.search.Attribute;
import net.sf.ehcache.search.Query;
import net.sf.ehcache.search.attribute.DynamicAttributesExtractor;
import net.sf.ehcache.statistics.CacheUsageListener;
import net.sf.ehcache.statistics.StatisticsGateway;
import net.sf.ehcache.terracotta.TerracottaNotRunningException;
import net.sf.ehcache.transaction.manager.TransactionManagerLookup;
import net.sf.ehcache.writer.CacheWriter;
import net.sf.ehcache.writer.CacheWriterManager;
/**
* An interface for Ehcache.
*
* Ehcache is the central interface. Caches have {@link Element}s and are managed
* by the {@link CacheManager}. The Cache performs logical actions. It delegates physical
* implementations to its {@link net.sf.ehcache.store.Store}s.
*
* A reference to an EhCache can be obtained through the {@link CacheManager}. An Ehcache thus obtained
* is guaranteed to have status {@link Status#STATUS_ALIVE}. This status is checked for any method which
* throws {@link IllegalStateException} and the same thrown if it is not alive. This would normally
* happen if a call is made after {@link CacheManager#shutdown} is invoked.
*
* Statistics on cache usage are collected and made available through public methods.
*
* @author Greg Luck
* @version $Id: Ehcache.java 10789 2018-04-26 02:08:13Z adahanne $
*/
public interface Ehcache extends Cloneable {
/**
* Put an element in the cache.
*
* Resets the access statistics on the element, which would be the case if it has previously been
* gotten from a cache, and is now being put back.
*
* Also notifies the CacheEventListener that:
*
*
the element was put, but only if the Element was actually put.
*
if the element exists in the cache, that an update has occurred, even if the element would be expired
* if it was requested
*
*
* @param element An object. If Serializable it can fully participate in replication and the DiskStore.
* @throws IllegalStateException if the cache is not {@link net.sf.ehcache.Status#STATUS_ALIVE}
* @throws IllegalArgumentException if the element is null
* @throws CacheException a runtime cache exception
*/
void put(Element element) throws IllegalArgumentException, IllegalStateException,
CacheException;
/**
* Puts a collection of elements in to the cache.
*
* This method will throw a {@code NullPointerException} if a null element or null key is encountered
* in the collection, and a partial completion may result (as only some of the elements may have been put).
*
* For each element that is put the registered {@code CacheEventListener}s are notified of a newly put item
* ({@link net.sf.ehcache.event.CacheEventListener#notifyElementPut(net.sf.ehcache.Ehcache, net.sf.ehcache.Element) notifyElementPut(...)})
* regardless of whether the individual put is a new put or an update.
*
* @param elements the collection of elements to be put in the cache.
* @throws IllegalStateException if the cache is not {@link net.sf.ehcache.Status#STATUS_ALIVE}
* @throws CacheException a runtime cache exception
*/
void putAll(Collection elements) throws IllegalArgumentException, IllegalStateException,
CacheException;
/**
* Put an element in the cache.
*
* Resets the access statistics on the element, which would be the case if it has previously been
* gotten from a cache, and is now being put back.
*
* Also notifies the CacheEventListener that:
*
*
the element was put, but only if the Element was actually put.
*
if the element exists in the cache, that an update has occurred, even if the element would be expired
* if it was requested
*
*
* @param element An object. If Serializable it can fully participate in replication and the DiskStore.
* @param doNotNotifyCacheReplicators whether the put is coming from a doNotNotifyCacheReplicators cache peer, in which case this put should not initiate a
* further notification to doNotNotifyCacheReplicators cache peers
* @throws IllegalStateException if the cache is not {@link net.sf.ehcache.Status#STATUS_ALIVE}
* @throws IllegalArgumentException if the element is null
*/
void put(Element element, boolean doNotNotifyCacheReplicators) throws IllegalArgumentException,
IllegalStateException,
CacheException;
/**
* Put an element in the cache, without updating statistics, or updating listeners. This is meant to be used
* in conjunction with {@link #getQuiet}
*
* @param element An object. If Serializable it can fully participate in replication and the DiskStore.
* @throws IllegalStateException if the cache is not {@link net.sf.ehcache.Status#STATUS_ALIVE}
* @throws IllegalArgumentException if the element is null
*/
void putQuiet(Element element) throws IllegalArgumentException, IllegalStateException,
CacheException;
/**
* Put an element in the cache writing through a CacheWriter. If no CacheWriter has been registered for the cache,
* then this method throws an exception.
*
* Resets the access statistics on the element, which would be the case if it has previously been
* gotten from a cache, and is now being put back.
*
* Also notifies the CacheEventListener, if the writer operation succeeds, that:
*
*
the element was put, but only if the Element was actually put.
*
if the element exists in the cache, that an update has occurred, even if the element would be expired
* if it was requested
*
*
* @param element An object. If Serializable it can fully participate in replication and the DiskStore.
* @throws IllegalStateException if the cache is not {@link net.sf.ehcache.Status#STATUS_ALIVE}
* @throws IllegalArgumentException if the element is null
* @throws CacheException if no CacheWriter was registered
*/
void putWithWriter(Element element) throws IllegalArgumentException, IllegalStateException, CacheException;
/**
* Put an element in the cache if no element is currently mapped to the elements key.
*
* @param element element to be added
* @return the element previously cached for this key, or null if none.
*
* @throws NullPointerException if the element is null, or has a null key
*/
Element putIfAbsent(Element element) throws NullPointerException;
/**
* Put an element in the cache if no element is currently mapped to the elements key.
*
* @param element element to be added
* @param doNotNotifyCacheReplicators whether the put is coming from a doNotNotifyCacheReplicators cache peer, in which case this put should not initiate a
* further notification to doNotNotifyCacheReplicators cache peers
* @return the element previously cached for this key, or null if none.
*
* @throws NullPointerException if the element is null, or has a null key
*/
Element putIfAbsent(Element element, boolean doNotNotifyCacheReplicators) throws NullPointerException;
/**
* Remove the Element mapped to the key for the supplied element if the value of the supplied Element
* compares equal to the value of the cached Element.
*
* except that the action is performed atomically.
*
* @param element Element to be removed
* @return {@code true} if the value was removed
*
* @throws NullPointerException if the element is null, or has a null key
*
* @see net.sf.ehcache.config.CacheConfiguration#addElementValueComparator(net.sf.ehcache.config.ElementValueComparatorConfiguration)
*/
boolean removeElement(Element element) throws NullPointerException;
/**
* Replace the cached element only if the current Element is equal to the supplied old Element.
*
* @param old Element to be test against
* @param element Element to be cached
* @return true if the Element was replaced
* @throws NullPointerException if the either Element is null or has a null key
* @throws IllegalArgumentException if the two Element keys are non-null but not equal
*/
boolean replace(Element old, Element element) throws NullPointerException, IllegalArgumentException;
/**
* Replace the cached element only if an Element is currently cached for this key
* @param element Element to be cached
* @return the Element previously cached for this key, or null if no Element was cached
* @throws NullPointerException if the Element is null or has a null key
*/
Element replace(Element element) throws NullPointerException;
/**
* Gets an element from the cache. Updates Element Statistics
*
* Note that the Element's lastAccessTime is always the time of this get.
* Use {@link #getQuiet(Object)} to peak into the Element to see its last access time with get
*
* @param key a serializable value
* @return the element, or null, if it does not exist.
* @throws IllegalStateException if the cache is not {@link net.sf.ehcache.Status#STATUS_ALIVE}
* @see #isExpired
*/
Element get(Serializable key) throws IllegalStateException, CacheException;
/**
* Gets an element from the cache. Updates Element Statistics
*
* Note that the Element's lastAccessTime is always the time of this get.
* Use {@link #getQuiet(Object)} to peek into the Element to see its last access time with get
*
* @param key an Object value
* @return the element, or null, if it does not exist.
* @throws IllegalStateException if the cache is not {@link net.sf.ehcache.Status#STATUS_ALIVE}
* @see #isExpired
* @since 1.2
*/
Element get(Object key) throws IllegalStateException, CacheException;
/**
* Gets all the elements from the cache for the keys provided. Updates Element Statistics
* Throws a NullPointerException if any key in the collection is null
*
* Note that the Element's lastAccessTime is always the time of this get.
* Use {@link #getQuiet(Object)} to peek into the Element to see its last access time with get
*
* @param keys a collection of keys for which value is to be fetched
* @return Map of key and elements for the provided keys, value will be null for the keys which do not exist
* @throws IllegalStateException if the cache is not {@link net.sf.ehcache.Status#STATUS_ALIVE}
* @throws NullPointerException if any key is null in the collection
* @see #isExpired
*/
Map