Cache results of getTermBy() to reduce db queries.
Fix random results query so unique entries are returned regardless of
the number of categories in wwhich the entry was associated with.

This fix addresses the issue where duplicates had to be removed before
the actual display to rpevent possible duplicates being displayed
to the user.