Refactor the way calls to memcache happen.

This is so we can reuse the memcache key updates in other hooks in the
future.