[erlang-questions] update_counter on steroids
Ulf Wiger
ulf@REDACTED
Wed Aug 7 15:03:23 CEST 2013
On 7 Aug 2013, at 14:58, Evgeny M <donpedrothird@REDACTED> wrote:
> I miss an ability to increment more than one counter for a given key.
Actually, you *can* do that already.
Eshell V5.10.2 (abort with ^G)
1> T = ets:new(t, [set]).
16400
2> ets:insert(T, {c, 0, 0, 0}).
true
3> ets:update_counter(T, c, [{2,1},{3,10},{4,100}]).
[1,10,100]
4> ets:lookup(T, c).
[{c,1,10,100}]
What I wanted to add was to capture values in previous operations
and use them for derived operations later in the same atomic update.
BR,
Ulf W
Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc.
http://feuerlabs.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130807/63a70981/attachment.htm>
More information about the erlang-questions
mailing list