Package aQute.lib.persistentmap
Class PersistentMap<V>
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Map<String,
V>
Implements a low performance but easy to use map that is backed on a
directory. All objects are stored as JSON objects and therefore should be
DTOs. Each key is a file name and the contents is the value encoded in JSON.
The PersistentMap will attempt to lock the directory. This is a
non-concurrent implementation so you must ensure it is only used in a single
thread. It cannot of course also not share the data directory.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,
V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Field Summary
FieldsModifier and TypeFieldDescription(package private) final Map<String,
SoftReference<V>> (package private) boolean
(package private) static final JSONCodec
(package private) final File
(package private) final File
private static final char
(package private) boolean
(package private) final RandomAccessFile
(package private) Type
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.util.AbstractMap
clone, containsKey, containsValue, equals, get, hashCode, isEmpty, putAll, remove, size, values
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
ESCAPE
private static final char ESCAPE- See Also:
-
codec
-
dir
-
data
-
lockFile
-
cache
-
inited
boolean inited -
closed
boolean closed -
type
Type type
-
-
Constructor Details
-
Method Details
-
init
void init() -
entrySet
-
put
-
lock
- Throws:
IOException
InterruptedException
-
unlock
- Throws:
IOException
-
remove
-
clear
public void clear() -
keySet
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
toString
- Overrides:
toString
in classAbstractMap<String,
V>
-
clear
public void clear(long whenOlder) -
keyToFile
-