I now use a pump kegwasher but before I had that I did the following:
* Rinse out the dirty stuff
* Use warm water PBW solution and shake that around.
* Pour a few liter(quarts) of boiling water, close and swirl it around. Empty it out, some through the gas out, some through the beer out.
*...