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

net.sf.ehcache.management.CacheStatisticsMBean Maven / Gradle / Ivy

There is a newer version: 2.10.9.2
Show newest version
/**
 *  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.management;

/**
 * @author Greg Luck
 * @version $Id: CacheStatisticsMBean.java 6907 2013-01-18 16:16:39Z cdennis $
 * @since 1.3
 */
public interface CacheStatisticsMBean {

    /**
     * The number of times a requested item was found in the cache.
     *
     * @return the number of times a requested item was found in the cache
     */
    long getCacheHits();

    /**
     * Number of times a requested item was found in the Memory Store.
     *
     * @return the number of times a requested item was found in memory
     */
    long getInMemoryHits();

    /**
     * Number of times a requested item was found in the off-heap store.
     *
     * @return the number of times a requested item was found off-heap, or 0 if there is no BigMemory storage configured.
     */
    long getOffHeapHits();

    /**
     * Number of times a requested item was found in the Disk Store.
     *
     * @return the number of times a requested item was found on Disk, or 0 if there is no disk storage configured.
     */
    long getOnDiskHits();

    /**
     * @return the number of times a requested element was not found in the cache
     */
    long getCacheMisses();

    /**
     * @return the number of times a requested element was not found in the memory cache
     */
    long getInMemoryMisses();

    /**
     * @return the number of times a requested element was not found in the off-heap cache
     */
    long getOffHeapMisses();

    /**
     * @return the number of times a requested element was not found in the disk cache
     */
    long getOnDiskMisses();

    /**
     * Gets the number of elements stored in the cache. Caclulating this can be expensive. Accordingly,
     * this method will return three different values, depending on the statistics accuracy setting.
     * 

Best Effort Size

* This result is returned when the statistics accuracy setting is {@link net.sf.ehcache.Statistics#STATISTICS_ACCURACY_BEST_EFFORT}. *

* The size is the number of {@link net.sf.ehcache.Element}s in the {@link net.sf.ehcache.store.MemoryStore} plus * the number of {@link net.sf.ehcache.Element}s in the {@link net.sf.ehcache.store.disk.DiskStore}. *

* This number is the actual number of elements, including expired elements that have * not been removed. Any duplicates between stores are accounted for. *

* Expired elements are removed from the the memory store when * getting an expired element, or when attempting to spool an expired element to * disk. *

* Expired elements are removed from the disk store when getting an expired element, * or when the expiry thread runs, which is once every five minutes. *

*

Guaranteed Accuracy Size

* This result is returned when the statistics accuracy setting is {@link net.sf.ehcache.Statistics#STATISTICS_ACCURACY_GUARANTEED}. *

* This method accounts for elements which might be expired or duplicated between stores. It take approximately * 200ms per 1000 elements to execute. *

Fast but non-accurate Size

* This result is returned when the statistics accuracy setting is {@link net.sf.ehcache.Statistics#STATISTICS_ACCURACY_NONE}. *

* The number given may contain expired elements. In addition if the DiskStore is used it may contain some double * counting of elements. It takes 6ms for 1000 elements to execute. Time to execute is O(log n). 50,000 elements take * 36ms. * * @return the number of elements in the ehcache, with a varying degree of accuracy, depending on accuracy setting. */ long getObjectCount(); /** * Gets the number of objects in the MemoryStore * @return the MemoryStore size which is always a count unadjusted for duplicates or expiries */ long getMemoryStoreObjectCount(); /** * Gets the number of objects in the OffHeapStore * @return the OffHeapStore size which is always a count unadjusted for duplicates or expiries */ long getOffHeapStoreObjectCount(); /** * Gets the number of objects in the DiskStore * @return the DiskStore size which is always a count unadjusted for duplicates or expiries */ long getDiskStoreObjectCount(); /** * @return the name of the Ehcache, or null is there no associated cache */ String getAssociatedCacheName(); /** * Returns the percentage of cache accesses that found a requested item in the cache. * * @return the percentage of successful hits */ double getCacheHitPercentage(); /** * Returns the percentage of cache accesses that did not find a requested element in the cache. * * @return the percentage of accesses that failed to find anything */ double getCacheMissPercentage(); /** * Returns the percentage of cache accesses that found a requested item cached in-memory. * * @return the percentage of successful hits from the MemoryStore */ double getInMemoryHitPercentage(); /** * Returns the percentage of cache accesses that found a requested item cached off-heap. * * @return the percentage of successful hits from the OffHeapStore */ double getOffHeapHitPercentage(); /** * Returns the percentage of cache accesses that found a requested item cached on disk. * * @return the percentage of successful hits from the DiskStore. */ double getOnDiskHitPercentage(); /** * Gets the size of the write-behind queue, if any. * The value is for all local buckets * @return Elements waiting to be processed by the write behind writer. -1 if no write-behind */ long getWriterQueueLength(); /** * Gets the maximum size of the write-behind queue, if any. * @return Maximum elements waiting to be processed by the write behind writer. -1 if no write-behind */ int getWriterMaxQueueSize(); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy