1 package org.apache.jcs.admin;
2
3 /*
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 */
21
22 /**
23 * Stores info on a cache element for the template
24 */
25 public class CacheElementInfo
26 {
27 /** element key */
28 String key = null;
29
30 /** is it eternal */
31 boolean eternal = false;
32
33 /** when it was created */
34 String createTime = null;
35
36 /** max life */
37 long maxLifeSeconds = -1;
38
39 /** when it will expire */
40 long expiresInSeconds = -1;
41
42 /**
43 * @return a string representation of the key
44 */
45 public String getKey()
46 {
47 return this.key;
48 }
49
50 /**
51 * @return true if the item does not expire
52 */
53 public boolean isEternal()
54 {
55 return this.eternal;
56 }
57
58 /**
59 * @return the time the object was created
60 */
61 public String getCreateTime()
62 {
63 return this.createTime;
64 }
65
66 /**
67 * Ignored if isEternal
68 * @return the longest this object can live.
69 */
70 public long getMaxLifeSeconds()
71 {
72 return this.maxLifeSeconds;
73 }
74
75 /**
76 * Ignored if isEternal
77 * @return how many seconds until this object expires.
78 */
79 public long getExpiresInSeconds()
80 {
81 return this.expiresInSeconds;
82 }
83
84 /**
85 * @return string info on the item
86 */
87 @Override
88 public String toString()
89 {
90 StringBuffer buf = new StringBuffer();
91 buf.append( "\nCacheElementInfo " );
92 buf.append( "\n Key [" + getKey() + "]" );
93 buf.append( "\n Eternal [" + isEternal() + "]" );
94 buf.append( "\n CreateTime [" + getCreateTime() + "]" );
95 buf.append( "\n MaxLifeSeconds [" + getMaxLifeSeconds() + "]" );
96 buf.append( "\n ExpiresInSeconds [" + getExpiresInSeconds() + "]" );
97
98 return buf.toString();
99 }
100 }