TS-1040 Add version to cached items

During race conditions when two processes access the cache, but a key/value is not present, both may try to execute create_new_key with one losing the race to insert to the new generation. This update supports database versioning and uses the latest version to resolve cache conflicts on insert.