/** * Saves key file to disk. This converts the LRUMap to a HashMap for deserialization. */ protected void saveKeys() { try { if (log.isInfoEnabled()) { log.info(logCacheName + "Saving keys to: " + fileName + ", key count: " + keyHash.size()); } keyFile.reset(); HashMap<K, IndexedDiskElementDescriptor> keys = new HashMap<K, IndexedDiskElementDescriptor>(); keys.putAll(keyHash); if (keys.size() > 0) { keyFile.writeObject(keys, 0); } if (log.isInfoEnabled()) { log.info(logCacheName + "Finished saving keys."); } } catch (IOException e) { log.error(logCacheName + "Problem storing keys.", e); } }
/** * Saves key file to disk. This converts the LRUMap to a HashMap for deserialization. */ protected void saveKeys() { try { if ( log.isInfoEnabled() ) { log.info( logCacheName + "Saving keys to: " + fileName + ", key count: " + keyHash.size() ); } keyFile.reset(); HashMap<K, IndexedDiskElementDescriptor> keys = new HashMap<K, IndexedDiskElementDescriptor>(); keys.putAll( keyHash ); if ( keys.size() > 0 ) { keyFile.writeObject( keys, 0 ); } if ( log.isInfoEnabled() ) { log.info( logCacheName + "Finished saving keys." ); } } catch ( Exception e ) { log.error( logCacheName + "Problem storing keys.", e ); } }