[erlang-questions] Guidance to a cache mechanism

Rapsey rapsey@REDACTED
Tue Oct 30 13:01:55 CET 2012


Do not use timer module. Use erlang:send_after/3
In my experience the timer module is unreliable and send_after will always
work.


Sergej

On Tue, Oct 30, 2012 at 12:08 PM, Maruthavanan Subbarayan <
maruthavanan_s@REDACTED> wrote:

> Hi,
>
> I have to develop a caching queue, which also should should after a expiry
> time.
>
> I may have around 500+ messages which may come in a second. Each message
> might contain 100-200 bytes.
>
> So I have designed the system like below.
>
> 1. Queue would be a gen server.
> 2. All messages which would come on same second would be stored in state
> of the gen_server like a record {datetime(),[<list of messages>]}
> 3. When the time differs, I would insert the above record to ets table and
> update the state of gen_server.
> 4. There would be a timer running timer:send_interval which would message
> timeout the gen_server for every second, when this message is received,
> then gen_server would delete the ets table according to expiry configured.
>
> I was looking on some guidance to check if the above is fine and with with
> stand the performance. I am foreseeing maximum expiry would be around 60
> minutes.
>
> Thanks,
> Marutha
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20121030/6f5757e5/attachment.htm>


More information about the erlang-questions mailing list