| 159 | /// |
| 160 | /// value from a previous put or null |
| 161 | public Object get(Object key) { |
| 162 | Object[] o = (Object[]) memoryCache.get(key); |
| 163 | if (o != null) { |
| 164 | return o[1]; |
| 165 | } |
| 166 | Object ref = weakCache.get(key); |
| 167 | if (ref != null) { |
| 168 | ref = Display.getInstance().extractHardRef(ref); |
| 169 | if (ref != null) { |
| 170 | // cache hit! Promote it to the hard cache again |
| 171 | put(key, ref); |
| 172 | return ref; |
| 173 | } |
| 174 | } |
| 175 | if (storageCacheSize > 0) { |
| 176 | Vector storageCacheContent = getStorageCacheContent(); |
| 177 | for (int iter = 0; iter < storageCacheContent.size(); iter++) { |
| 178 | Object[] obj = (Object[]) storageCacheContent.elementAt(iter); |
| 179 | if (obj[1].equals(key)) { |
| 180 | // place the object back into the memory cache and return the value |
| 181 | Vector v = (Vector) Storage.getInstance().readObject("$CACHE$" + cachePrefix + key); |
| 182 | if (v != null) { |
| 183 | Object val = v.elementAt(0); |
| 184 | put(key, val); |
| 185 | return val; |
| 186 | } |
| 187 | return null; |
| 188 | } |
| 189 | } |
| 190 | } |
| 191 | return null; |
| 192 | } |
| 193 | |
| 194 | /// Clears the caches for this cache object |
| 195 | public void clearAllCache() { |