[erlang-questions] update_counter on steroids

Evgeny M donpedrothird@REDACTED
Wed Aug 7 17:56:26 CEST 2013


Sorry, I thought this post is about mnesia dirty_update_counters
My bad

среда, 7 августа 2013 г., 17:03:23 UTC+4 пользователь Ulf Wiger написал:
>
>
> On 7 Aug 2013, at 14:58, Evgeny M <donped...@REDACTED <javascript:>> 
> 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/fbcc58b5/attachment.htm>


More information about the erlang-questions mailing list