Memcached StorageService
Marvin Addison
marvin.addison at gmail.com
Mon Sep 29 14:31:01 EDT 2014
>> Ideally, StorageRecord#version would be a long to support #1.
>That's immaterial to me, we can make it a long.
Great! I was thinking implementations can store int for efficiency if
needed and report long for the API contract.
> [boolean return] wouldn't support the SP's session cache, and that tells me
> that it would be a dangerous thing to assume that it's never going to
> matter.
I'm having trouble understanding the usage pattern. Are you making
successive calls to updateWithVersion with no intervening reads?
> It's a transactional API, to hide the need to do that exact thing,
> a read after an update.
I'm fairly certain I can conform to the API contract, but it may not
be very meaningful and come at the cost of performance.
> One option would be to require that the versions be monotonically
> increasing, so that if you call updateWithVersion(), a success guarantees
> that the input version is now version + 1.
Memcached can't meet that requirement with cas_unique. While it's
strictly monotonically increasing, it increases by a variable amount
that is a function of the total number of writes on the cache.
(cas_unique is backed by a global static variable [1].)
Thanks,
M
[1] https://github.com/memcached/memcached/blob/e73bc2e5c0794cccd6f8ece63bc16433c40ed766/items.c#L56
More information about the dev
mailing list