Cache registered attributes

Depends on #296, merge that one first.