001package org.apache.commons.jcs.admin; 002 003/* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022import java.beans.ConstructorProperties; 023 024 025 026/** 027 * Stores info on a cache region for the template 028 */ 029public class CacheRegionInfo 030{ 031 /** The name of the cache region */ 032 private final String cacheName; 033 034 /** The size of the cache region */ 035 private final int cacheSize; 036 037 /** The status of the cache region */ 038 private final String cacheStatus; 039 040 /** The statistics of the cache region */ 041 private final String cacheStatistics; 042 043 /** The number of memory hits in the cache region */ 044 private final int hitCountRam; 045 046 /** The number of auxiliary hits in the cache region */ 047 private final int hitCountAux; 048 049 /** The number of misses in the cache region because the items were not found */ 050 private final int missCountNotFound; 051 052 /** The number of misses in the cache region because the items were expired */ 053 private final int missCountExpired; 054 055 /** The number of bytes counted so far, will be a total of all items */ 056 private final long byteCount; 057 058 /** 059 * Parameterized constructor 060 * 061 * @param cacheName The name of the cache region 062 * @param cacheSize The size of the cache region 063 * @param cacheStatus The status of the cache region 064 * @param cacheStatistics The statistics of the cache region 065 * @param hitCountRam The number of memory hits in the cache region 066 * @param hitCountAux The number of auxiliary hits in the cache region 067 * @param missCountNotFound The number of misses in the cache region because the items were not found 068 * @param missCountExpired The number of misses in the cache region because the items were expired 069 * @param byteCount The number of bytes counted so far, will be a total of all items 070 */ 071 @ConstructorProperties({"cacheName", "cacheSize", "cacheStatus", "cacheStatistics", 072 "hitCountRam", "hitCountAux", "missCountNotFound", "missCountExpired", "byteCount"}) 073 public CacheRegionInfo(String cacheName, int cacheSize, String cacheStatus, 074 String cacheStatistics, int hitCountRam, int hitCountAux, 075 int missCountNotFound, int missCountExpired, long byteCount) 076 { 077 super(); 078 this.cacheName = cacheName; 079 this.cacheSize = cacheSize; 080 this.cacheStatus = cacheStatus; 081 this.cacheStatistics = cacheStatistics; 082 this.hitCountRam = hitCountRam; 083 this.hitCountAux = hitCountAux; 084 this.missCountNotFound = missCountNotFound; 085 this.missCountExpired = missCountExpired; 086 this.byteCount = byteCount; 087 } 088 089 /** 090 * @return the cacheName 091 */ 092 public String getCacheName() 093 { 094 return this.cacheName; 095 } 096 097 /** 098 * @return the cacheSize 099 */ 100 public int getCacheSize() 101 { 102 return this.cacheSize; 103 } 104 105 /** 106 * @return a status string 107 */ 108 public String getCacheStatus() 109 { 110 return this.cacheStatus; 111 } 112 113 /** 114 * Return the statistics for the region. 115 * <p> 116 * @return String 117 */ 118 public String getCacheStatistics() 119 { 120 return this.cacheStatistics; 121 } 122 123 /** 124 * @return the hitCountRam 125 */ 126 public int getHitCountRam() 127 { 128 return hitCountRam; 129 } 130 131 /** 132 * @return the hitCountAux 133 */ 134 public int getHitCountAux() 135 { 136 return hitCountAux; 137 } 138 139 /** 140 * @return the missCountNotFound 141 */ 142 public int getMissCountNotFound() 143 { 144 return missCountNotFound; 145 } 146 147 /** 148 * @return the missCountExpired 149 */ 150 public int getMissCountExpired() 151 { 152 return missCountExpired; 153 } 154 155 /** 156 * @return total byte count 157 */ 158 public long getByteCount() 159 { 160 return this.byteCount; 161 } 162 163 /** 164 * @return string info on the region 165 */ 166 @Override 167 public String toString() 168 { 169 StringBuilder buf = new StringBuilder(); 170 buf.append( "\nCacheRegionInfo " ); 171 if ( cacheName != null ) 172 { 173 buf.append( "\n CacheName [" + cacheName + "]" ); 174 buf.append( "\n Status [" + cacheStatus + "]" ); 175 } 176 buf.append( "\n ByteCount [" + getByteCount() + "]" ); 177 178 return buf.toString(); 179 } 180}