Optimized the image cache store() function slightly by avoiding
unnecessary database inserts.
A write operation in the database will lock the table and
potentially generate an image cache stall in other handler
threads. Therefore do a select first to determine if the insert
is needed. This should speed up restarted servers with an