added simple SQLite caching, which seems to mostly work