001 /* 002 * Copyright 2001-2004 The Apache Software Foundation 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package org.apache.commons.cache; 017 018 import java.io.Serializable; 019 020 /** 021 * . 022 * 023 * @ATVERSION@ 024 * @author Rodney Waldhoff 025 */ 026 public final class CacheStat implements Serializable { 027 private static int _counter = 0; 028 029 public final String strVal; 030 public final int intVal = _counter++; 031 032 private CacheStat() { 033 strVal= null; 034 } 035 036 private CacheStat(String name) { 037 strVal= name; 038 } 039 040 public String toString() { 041 return strVal; 042 } 043 044 public int getIntValue() { 045 return intVal; 046 } 047 048 public String getStrValue() { 049 return strVal; 050 } 051 052 public boolean equals(CacheStat stat) { 053 return (null != stat && stat.strVal.equals(strVal)); 054 } 055 056 public int hashCode() { 057 return intVal; 058 } 059 060 public static final CacheStat NUM_RETRIEVE_REQUESTED = new CacheStat("number of retrievals requested"); 061 public static final CacheStat NUM_RETRIEVE_FOUND = new CacheStat("number of retrievals found"); 062 public static final CacheStat NUM_RETRIEVE_NOT_FOUND = new CacheStat("number of retrievals not found"); 063 public static final CacheStat NUM_STORE_REQUESTED = new CacheStat("number of stores requested"); 064 public static final CacheStat NUM_STORE_STORED = new CacheStat("number of objects stored"); 065 public static final CacheStat NUM_STORE_NOT_STORED = new CacheStat("number of objects not stored"); 066 public static final CacheStat NUM_CLEARED = new CacheStat("number of objects cleared"); 067 public static final CacheStat CUR_CAPACITY = new CacheStat("current capacity"); 068 }