Add Query cache

Adds a Query cache and fixes Singleton __init__