Refine data storing and caching, fix JID pollution of DB.

  - Add missing cost accounting a few places.
  - Clearly name cached, querying, and storing functions.  Add missing ones.
  - Use cached or querying variants where possible.
Bump version to 0.2.