Optimize management of nil id

Fail-fast when the id received is nil. Remove a get and set call to the memcache layer(each call) and a call to mysql(once).

Possible impact: If the `where` was to be overloaded it could potentially lead to a behaviour change if there was a special handling of the nil case.

cc: @arthurnn