KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > whirlycott > cache > CacheConfiguration


1 package com.whirlycott.cache;
2
3 import java.util.HashMap JavaDoc;
4 import java.util.Map JavaDoc;
5
6 /*
7  
8  Licensed under the Apache License, Version 2.0 (the "License");
9  you may not use this file except in compliance with the License.
10  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, software
15  distributed under the License is distributed on an "AS IS" BASIS,
16  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  See the License for the specific language governing permissions and
18  limitations under the License.
19  
20  */

21
22 /**
23  * Represents the configuration for an individual Cache object.
24  *
25  * @author <a HREF="mailto:peter.royal@pobox.com">peter royal</a>
26  */

27 public class CacheConfiguration {
28
29     private final Map JavaDoc attributes = new HashMap JavaDoc();
30
31     /**
32      * The backend implementation of ManagedCache that this cache will use.
33      */

34     private String JavaDoc backend;
35
36     /**
37      * The maximum number of elements that can be in this cache. This is a soft limit.
38      */

39     private int maxSize;
40
41     /**
42      * The name of the cache.
43      */

44     private String JavaDoc name;
45
46     /**
47      * The eviction policy that this cache will use.
48      */

49     private String JavaDoc policy;
50
51     /**
52      * The time between eviction runs.
53      */

54     private int tunerSleepTime;
55
56     public String JavaDoc getAttribute(final String JavaDoc attribute) {
57         return (String JavaDoc) attributes.get(attribute);
58     }
59
60     public String JavaDoc getBackend() {
61         return backend;
62     }
63
64     public int getMaxSize() {
65         return maxSize;
66     }
67
68     public String JavaDoc getName() {
69         return name;
70     }
71
72     public String JavaDoc getPolicy() {
73         return policy;
74     }
75
76     public int getTunerSleepTime() {
77         return tunerSleepTime;
78     }
79
80     public void setAttribute(final String JavaDoc attribute, final String JavaDoc value) {
81         attributes.put(attribute, value);
82     }
83
84     public void setBackend(final String JavaDoc backend) {
85         this.backend = backend;
86     }
87
88     public void setMaxSize(final int maxSize) {
89         this.maxSize = maxSize;
90     }
91
92     public void setName(final String JavaDoc name) {
93         this.name = name;
94     }
95
96     public void setPolicy(final String JavaDoc policy) {
97         this.policy = policy;
98     }
99
100     public void setTunerSleepTime(final int tunerSleepTime) {
101         this.tunerSleepTime = tunerSleepTime;
102     }
103 }
Popular Tags