All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sf.ehcache.statistics.CacheUsageListener Maven / Gradle / Ivy

Go to download

This is the ehcache core module. Pair it with other modules for added functionality.

There is a newer version: 2.6.11
Show newest version
/**
 *  Copyright 2003-2010 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.statistics;

/**
 * Interface for listeners to any change in usage statistics of an
 * Ehcache.
 *
 * 

* Implementations of this interface should implement the {@link Object#equals(Object)} and the {@link Object#hashCode()} as registering and * removing listeners depends on these *

* * @author Abhishek Sanoujam * @since 1.7 */ public interface CacheUsageListener { /** * Called when statistics is enabled/disabled * * @param enableStatistics */ void notifyStatisticsEnabledChanged(boolean enableStatistics); /** * Called when statistics is cleared */ void notifyStatisticsCleared(); /** * Called on a cache hit in the MemoryStore */ void notifyCacheHitInMemory(); /** * Called on a cache hit in the off-heap store */ void notifyCacheHitOffHeap(); /** * Called on a cache hit in the DiskStore */ void notifyCacheHitOnDisk(); /** * Called when an element is inserted in the cache */ void notifyCacheElementPut(); /** * Called when an element is updated in the cache, i.e. a put for an already * existing key */ void notifyCacheElementUpdated(); /** * Called when an element is not found in the cache */ void notifyCacheMissedWithNotFound(); /** * Called on a cache miss in the MemoryStore */ void notifyCacheMissInMemory(); /** * Called on a cache miss in the off-heap store */ void notifyCacheMissOffHeap(); /** * Called on a cache miss in the DiskStore */ void notifyCacheMissOnDisk(); /** * Called when an element is found in the cache but already expired */ void notifyCacheMissedWithExpired(); /** * Notified with time taken for a get operation in the cache * * @param millis */ void notifyTimeTakenForGet(final long millis); /** * Called when an element is expired in the cache */ void notifyCacheElementEvicted(); /** * Called when an element in the cache expires */ void notifyCacheElementExpired(); /** * Called when an element is removed from the cache */ void notifyCacheElementRemoved(); /** * Called when Cache.removeAll() is called */ void notifyRemoveAll(); /** * Notified when the statistics accuracy is changed. * * @param statisticsAccuracy * one of Statistics#STATISTICS_ACCURACY_BEST_EFFORT, * Statistics#STATISTICS_ACCURACY_GUARANTEED, * Statistics#STATISTICS_ACCURACY_NONE */ void notifyStatisticsAccuracyChanged(int statisticsAccuracy); /** * Called to dispose off the listener */ void dispose(); /** * Called when a search finishes execution * * @param executeTime elapsed time in millis */ void notifyCacheSearch(long executeTime); /** * Called when the Cache's XAResource has been asked to commit */ void notifyXaCommit(); /** * Called when the Cache's XAResource has been asked to rollback */ void notifyXaRollback(); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy