001package org.apache.commons.jcs3.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 long hitCountRam; 045 046 /** The number of auxiliary hits in the cache region */ 047 private final long hitCountAux; 048 049 /** The number of misses in the cache region because the items were not found */ 050 private final long missCountNotFound; 051 052 /** The number of misses in the cache region because the items were expired */ 053 private final long 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(final String cacheName, final int cacheSize, final String cacheStatus, 074 final String cacheStatistics, final long hitCountRam, final long hitCountAux, 075 final long missCountNotFound, final long missCountExpired, final long byteCount) 076 { 077 this.cacheName = cacheName; 078 this.cacheSize = cacheSize; 079 this.cacheStatus = cacheStatus; 080 this.cacheStatistics = cacheStatistics; 081 this.hitCountRam = hitCountRam; 082 this.hitCountAux = hitCountAux; 083 this.missCountNotFound = missCountNotFound; 084 this.missCountExpired = missCountExpired; 085 this.byteCount = byteCount; 086 } 087 088 /** 089 * @return the cacheName 090 */ 091 public String getCacheName() 092 { 093 return this.cacheName; 094 } 095 096 /** 097 * @return the cacheSize 098 */ 099 public int getCacheSize() 100 { 101 return this.cacheSize; 102 } 103 104 /** 105 * @return a status string 106 */ 107 public String getCacheStatus() 108 { 109 return this.cacheStatus; 110 } 111 112 /** 113 * Return the statistics for the region. 114 * <p> 115 * @return String 116 */ 117 public String getCacheStatistics() 118 { 119 return this.cacheStatistics; 120 } 121 122 /** 123 * @return the hitCountRam 124 */ 125 public long getHitCountRam() 126 { 127 return hitCountRam; 128 } 129 130 /** 131 * @return the hitCountAux 132 */ 133 public long getHitCountAux() 134 { 135 return hitCountAux; 136 } 137 138 /** 139 * @return the missCountNotFound 140 */ 141 public long getMissCountNotFound() 142 { 143 return missCountNotFound; 144 } 145 146 /** 147 * @return the missCountExpired 148 */ 149 public long getMissCountExpired() 150 { 151 return missCountExpired; 152 } 153 154 /** 155 * @return total byte count 156 */ 157 public long getByteCount() 158 { 159 return this.byteCount; 160 } 161 162 /** 163 * @return string info on the region 164 */ 165 @Override 166 public String toString() 167 { 168 final StringBuilder buf = new StringBuilder(); 169 buf.append( "\nCacheRegionInfo " ); 170 if ( cacheName != null ) 171 { 172 buf.append( "\n CacheName [" + cacheName + "]" ); 173 buf.append( "\n Status [" + cacheStatus + "]" ); 174 } 175 buf.append( "\n ByteCount [" + getByteCount() + "]" ); 176 177 return buf.toString(); 178 } 179}