Added sanity check if logging was enabled

No more wrapping calls to the Log class with a check if it's enabled.
Caching where primary key in ( ... )

Caching was limited to single row selects against the primary key. Expanded to include cache checking and storing when selecting multiple values against the primary key. Does not work on any other row due to the fact that some rows may have duplicate values and the mapping could get borked pretty quick.
Removed unnecessary sanity checks when calling Log