vsavkin / PersistentHashMap

An implementation of a map that can be saved to a file and can be read from a file.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

An implementation of a map that can be saved to a file and can be read from a file.


Languages

Language:Groovy 100.0%