<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span>Ok, I've already written a very simple cache function </span><span style="font-size: 12pt;"> </span><span style="font-size: 12pt;">(based on ets) </span><span style="font-size: 12pt;">for other usage, it just happens that you could probably use that to cache anything.</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;"><span><br></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;"><span>We might want to use SSL in our solution.</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color:
transparent; font-style: normal;"><span><br></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;"><span>I guess I should do some measurements then.</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;"><span><br></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;"><span>NOTE: this is just html and js files so it might be that the OS caching function is sufficient.</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;"><span><br></span></div><div style="color: rgb(0, 0, 0); font-size:
16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;"><span>Thanks,</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;"><span>Johan</span></div><div><br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; margin-top: 5px; padding-left: 5px;"> <div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"> <div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"> <div dir="ltr"> <hr size="1"> <font size="2" face="Arial"> <b><span style="font-weight:bold;">From:</span></b> Loïc Hoguin <essen@ninenines.eu><br> <b><span style="font-weight: bold;">To:</span></b> J K <jmakarlsson@yahoo.com> <br><b><span style="font-weight: bold;">Cc:</span></b> Erlang Questions
<erlang-questions@erlang.org> <br> <b><span style="font-weight: bold;">Sent:</span></b> Friday, July 5, 2013 4:08 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [erlang-questions] Cowboy static file cahce<br> </font> </div> <div class="y_msg_container"><br>On 07/05/2013 03:52 PM, J K wrote:<br>> Hi,<br>> does anyone know if Cowboy can do static file caching?<br><br>It doesn't, you could do it, but you probably shouldn't do it.<br><br>When using TCP the static handler will use sendfile to send the files. <br>Sendfile does the write directly from the kernel, and if the file was in <br>the kernel file cache (if it was requested before/enough) it'll be very <br>fast.<br><br>When using SSL you can't just write the file to the socket. So you might <br>want something else.<br><br>Generally the best solution is to use a CDN for files (on a cookie-less <br>domain) and this is the only recommendation we make. The static handler
<br>is only there to help during development.<br><br>-- <br>Loïc Hoguin<br>Erlang Cowboy<br>Nine Nines<br><a href="http://ninenines.eu/" target="_blank">http://ninenines.eu</a><br><br><br></div> </div> </div> </blockquote></div> </div></body></html>