<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hello Max,<div><br></div><div>Like, I've said that code is proto level. I have not brought it anywhere except my test env.</div><div>However, it is very simple and straight forward. This is nothing more then gen_server controlling ETS </div><div>As part of immediate improvements, I'd like to highlite</div><div> - change of cache i/o (they are masked behind gen_server)</div><div> - make a notification during eviction process</div><div> </div><div>You are right, it is missing the documentation but it would be possible to add it.</div><div>I am preparing to use it for one of my solution where I need multiple eviction policy including TTL & memory threshold  </div><div><br></div><div>- Dmitry </div><div><br></div><div><br><div><div>On Mar 14, 2013, at 4:38 PM, Max Bourinov <<a href="mailto:bourinov@gmail.com">bourinov@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hi Dmitry,<div><br></div><div>Thank you for sharing your code. Do you plan to add some docs to it?</div><div><br></div><div>Do you use this project? At which state it is now?</div><div><br clear="all"><div><div>Best regards,</div>

<div>Max</div><br></div>
<br><br><div class="gmail_quote">On Thu, Mar 14, 2013 at 3:29 PM, Dmitry Kolesnikov <span dir="ltr"><<a href="mailto:dmkolesnikov@gmail.com" target="_blank">dmkolesnikov@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div dir="auto"><div>Hello Max,</div><div><br></div><div>I have been experimenting with similar approach. The main idea was to keep a two ETS based indexes. The first one it key-value map, second is expire-key map. Second index allows you to handle eviction. You have a process that evict a items when they are expired. </div>

<div><br></div><div>I did a quick proto but never had opportunity to evolve it further. </div><div><span style="font-family:'.HelveticaNeueUI';font-size:15px;line-height:19px;white-space:nowrap"><a href="https://github.com/fogfish/cache" target="_blank">https://github.com/fogfish/cache</a></span><br>

<br>It would be excellent to get community comments on it.</div><div><br></div><div><br>Best Regards,<div>Dmitry >-|-|-*></div><div><br></div></div><div><div class="h5"><div><br>On 14.3.2013, at 16.15, Max Bourinov <<a href="mailto:bourinov@gmail.com" target="_blank">bourinov@gmail.com</a>> wrote:<br>

<br></div><blockquote type="cite">Hi Erlangers,<div><br></div><div>How would you implement TTL with callback for ETS based cache?</div><div><br></div><div>I want when TTL expires callback is triggered and cached value goes to DB.</div>

<div><br></div><div>For key I use 32 byte long binary(), value is not bigger than 8 KB. </div>

<div><br></div><div>Any suggestions?</div><div><br></div><div>p.s. elang:send_after/3 is a most brutal approach, but how would it be when cache is under load?</div><div><br clear="all"><div><div>Best regards,</div><div>Max</div>



<br></div>
</div>
</blockquote></div></div><blockquote type="cite"><span>_______________________________________________</span><br><span>erlang-questions mailing list</span><br><span><a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a></span><br>

<span><a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a></span><br></blockquote></div></blockquote></div><br></div>
</blockquote></div><br></div></body></html>