Save rails middleware instance variable by thread.