Use username instead of user itself as a cache key - try to avoid using object from already closed db connections and ConnectionStateError exceptions