duomark/epocxy — pull request #41 by jaynel (2014-12-03 08:29:59+00:00)
Title: Add version to cxy_cache values, only store latest version

Also rearranged some code to narrow race condition windows by avoiding initialization of local data after reading metadata from ets. Instead all local work is done first, then metadata is read, followed immediately by cache updates.

create_key_value now should return {cached_version(), cached_value()} and cxy_cache takes care of clobbering outdated cache values, but only in the case of a race when two processes insert conflicting versions of a value.