An implementation of a map that can be saved to a file and can be read from a file.
Groovy
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
.gitignore
README
build.gradle

README

PersistentHashMap implements Map interface and adds two additional operations to it.
reread() - reads a hash map from a file.
flush() - saves a hash map to a file.

All operations are thread safe.

Basic use case:
def map = new PersistentHashMap(file)
map['key'] = 'value'
map.flush()

It uses objectStream under the hood. As a result all the objects must implement Serializable to be saved.

If an external process changes the file flush will throw an exception.

For more information:
http://vsavkin.tumblr.com/post/2765543454/persistenthashmap-in-groovy