1 package org.apache.commons.jcs.auxiliary.disk;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.commons.jcs.engine.CacheElement;
23 import org.apache.commons.jcs.engine.behavior.ICacheElement;
24 import org.apache.commons.jcs.engine.behavior.IElementAttributes;
25
26
27
28
29
30
31
32 public class PurgatoryElement<K, V>
33 extends CacheElement<K, V>
34 {
35
36 private static final long serialVersionUID = -8152034342684135628L;
37
38
39 private boolean spoolable = false;
40
41
42 private ICacheElement<K, V> cacheElement;
43
44
45
46
47
48
49 public PurgatoryElement( ICacheElement<K, V> cacheElement )
50 {
51 super(cacheElement.getCacheName(),
52 cacheElement.getKey(), cacheElement.getVal(),
53 cacheElement.getElementAttributes());
54 this.cacheElement = cacheElement;
55 }
56
57
58
59
60
61
62 public boolean isSpoolable()
63 {
64 return spoolable;
65 }
66
67
68
69
70
71
72 public void setSpoolable( boolean spoolable )
73 {
74 this.spoolable = spoolable;
75 }
76
77
78
79
80
81
82 public ICacheElement<K, V> getCacheElement()
83 {
84 return cacheElement;
85 }
86
87
88
89
90
91
92
93 @Override
94 public String getCacheName()
95 {
96 return cacheElement.getCacheName();
97 }
98
99
100
101
102
103 @Override
104 public K getKey()
105 {
106 return cacheElement.getKey();
107 }
108
109
110
111
112
113 @Override
114 public V getVal()
115 {
116 return cacheElement.getVal();
117 }
118
119
120
121
122
123 @Override
124 public IElementAttributes getElementAttributes()
125 {
126 return cacheElement.getElementAttributes();
127 }
128
129
130
131
132
133 @Override
134 public void setElementAttributes( IElementAttributes attr )
135 {
136 cacheElement.setElementAttributes( attr );
137 }
138
139
140
141
142 @Override
143 public String toString()
144 {
145 StringBuilder buf = new StringBuilder();
146 buf.append( "[PurgatoryElement: " );
147 buf.append( " isSpoolable = " + isSpoolable() );
148 buf.append( " CacheElement = " + getCacheElement() );
149 buf.append( " CacheName = " + getCacheName() );
150 buf.append( " Key = " + getKey() );
151 buf.append( " Value = " + getVal() );
152 buf.append( " ElementAttributes = " + getElementAttributes() );
153 buf.append( "]" );
154 return buf.toString();
155 }
156 }