make the cache threadsafe using synchronizedMap - fixes #1