All,<br><br>These are excellent responses! Thanks so much. I can't wait to begin implementing memecached in my PHP applications.<br><br>-Nathan<br><br><div><span class="gmail_quote">On 5/21/07, <b class="gmail_sendername">
<a href="mailto:memcached-request@lists.danga.com">memcached-request@lists.danga.com</a></b> <<a href="mailto:memcached-request@lists.danga.com">memcached-request@lists.danga.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Send memcached mailing list submissions to<br> <a href="mailto:memcached@lists.danga.com">memcached@lists.danga.com</a><br><br>To subscribe or unsubscribe via the World Wide Web, visit<br> <a href="http://lists.danga.com/mailman/listinfo/memcached">
http://lists.danga.com/mailman/listinfo/memcached</a><br>or, via email, send a message with subject or body 'help' to<br> <a href="mailto:memcached-request@lists.danga.com">memcached-request@lists.danga.com
</a><br><br>You can reach the person managing the list at<br> <a href="mailto:memcached-owner@lists.danga.com">memcached-owner@lists.danga.com</a><br><br>When replying, please edit your Subject line so it is more specific
<br>than "Re: Contents of memcached digest..."<br><br><br>Today's Topics:<br><br> 1. telling code to pull from the database when the data in a<br> table changes (Nathan Nobbe)<br> 2. Re: telling code to pull from the database when the data in a
<br> table changes (Tomas Markauskas)<br> 3. Re: telling code to pull from the database when the data in a<br> table changes (Thomas Seifert)<br> 4. Re: telling code to pull from the database when the data in a
<br> table changes (KevinImNotSpacey)<br><br><br>----------------------------------------------------------------------<br><br>Message: 1<br>Date: Mon, 21 May 2007 10:05:19 -0400<br>From: "Nathan Nobbe" <
<a href="mailto:quickshiftin@gmail.com">quickshiftin@gmail.com</a>><br>Subject: telling code to pull from the database when the data in a<br> table changes<br>To: <a href="mailto:memcached@lists.danga.com">memcached@lists.danga.com
</a><br>Message-ID:<br> <<a href="mailto:7dd2dc0b0705210705q57b7ccdag1302251325293bca@mail.gmail.com">7dd2dc0b0705210705q57b7ccdag1302251325293bca@mail.gmail.com</a>><br>Content-Type: text/plain; charset="iso-8859-1"
<br><br>All,<br><br>I recently began investigating memcached, and im very excited about it. im<br>planning on using it w/ php to implement variables whose lifetime can be the<br>duration of the application.<br>I understand that storing the results of queries to the database can
<br>increase efficiency if those variables are checked for the data first on<br>consecutive requests for the data they store, but<br>i still have a disconnect...<br>what i dont understand is when the data profile of a particular table
<br>changes, and the variable in the memcache that represents that table becomes<br>stale, how can the variable be updated efficiently?<br>obviously w/ php and a unix system, a simple cron could be used to poll the<br>database periodically to see if there are changes to the data profile of a
<br>given table. i was thinking to make this even more<br>efficient; triggers could be employed (im using mysql 5+) to update a table,<br>call it recent_tables_that_changed, dedicated to signifying particular<br>tables in the database have changed. then the cron'd php script could
<br>simply check recent_tables_that_changed to determine which, if any,<br>application variables had become stale (do to a change in data profile).<br>the stale variable could then be updated and the record removed from
<br>recent_tables_that_changed.<br>though decent, i am personally not a fan of this approach, because there<br>would still be a frequent query running against the database just to<br>determine what data had changed so that application variables in the cache
<br>would not remain stale for long once theyve become stale. additionally, the<br>mechanisms' responsiveness would be limited to the time granularity of cron,<br>which i believe is a minute. im wondering if there is some way to signal
<br>the cache only when tables, represented by application variables, have<br>changed. if you dont feel like typing out a response, because this is<br>probably a naive question, would anyone mind directing me to a resource or
<br>two where i could read up on the topic myself?<br><br>(sorry for the lengthy posting)<br>thanks,<br><br>-Nathan<br>-------------- next part --------------<br>An HTML attachment was scrubbed...<br>URL: <a href="http://lists.danga.com/pipermail/memcached/attachments/20070521/ac143a94/attachment-0001.htm">
http://lists.danga.com/pipermail/memcached/attachments/20070521/ac143a94/attachment-0001.htm</a><br><br>------------------------------<br><br>Message: 2<br>Date: Mon, 21 May 2007 16:12:17 +0200<br>From: "Tomas Markauskas" <
<a href="mailto:info@tamole.net">info@tamole.net</a>><br>Subject: Re: telling code to pull from the database when the data in a<br> table changes<br>To: "Nathan Nobbe" <<a href="mailto:quickshiftin@gmail.com">
quickshiftin@gmail.com</a>>, <a href="mailto:memcached@lists.danga.com">memcached@lists.danga.com</a><br>Message-ID:<br> <<a href="mailto:8edd6e790705210712h27fafe6fj71ad72768631cb2@mail.gmail.com">8edd6e790705210712h27fafe6fj71ad72768631cb2@mail.gmail.com
</a>><br>Content-Type: text/plain; charset=UTF-8; format=flowed<br><br>Hello,<br><br>why not deleting/updating the cache entry when you updating the table?<br>At that moment you know, which rows you're updating.<br>
<br>Tomas<br><br>On 5/21/07, Nathan Nobbe <<a href="mailto:quickshiftin@gmail.com">quickshiftin@gmail.com</a>> wrote:<br>> All,<br>><br>> I recently began investigating memcached, and im very excited about it. im
<br>> planning on using it w/ php to implement variables whose lifetime can be the<br>> duration of the application.<br>> I understand that storing the results of queries to the database can<br>> increase efficiency if those variables are checked for the data first on
<br>> consecutive requests for the data they store, but<br>> i still have a disconnect...<br>> what i dont understand is when the data profile of a particular table<br>> changes, and the variable in the memcache that represents that table becomes
<br>> stale, how can the variable be updated efficiently?<br>> obviously w/ php and a unix system, a simple cron could be used to poll the<br>> database periodically to see if there are changes to the data profile of a
<br>> given table. i was thinking to make this even more<br>> efficient; triggers could be employed (im using mysql 5+) to update a table,<br>> call it recent_tables_that_changed, dedicated to signifying particular
<br>> tables in the database have changed. then the cron'd php script could<br>> simply check recent_tables_that_changed to determine which, if any,<br>> application variables had become stale (do to a change in data profile).
<br>> the stale variable could then be updated and the record removed from<br>> recent_tables_that_changed.<br>> though decent, i am personally not a fan of this approach, because there<br>> would still be a frequent query running against the database just to
<br>> determine what data had changed so that application variables in the cache<br>> would not remain stale for long once theyve become stale. additionally, the<br>> mechanisms' responsiveness would be limited to the time granularity of cron,
<br>> which i believe is a minute. im wondering if there is some way to signal<br>> the cache only when tables, represented by application variables, have<br>> changed. if you dont feel like typing out a response, because this is
<br>> probably a naive question, would anyone mind directing me to a resource or<br>> two where i could read up on the topic myself?<br>><br>> (sorry for the lengthy posting)<br>> thanks,<br>><br>> -Nathan
<br>><br><br><br>------------------------------<br><br>Message: 3<br>Date: Mon, 21 May 2007 16:14:30 +0200<br>From: Thomas Seifert <<a href="mailto:thomas-lists@mysnip.de">thomas-lists@mysnip.de</a>><br>Subject: Re: telling code to pull from the database when the data in a
<br> table changes<br>To: Nathan Nobbe <<a href="mailto:quickshiftin@gmail.com">quickshiftin@gmail.com</a>><br>Cc: <a href="mailto:memcached@lists.danga.com">memcached@lists.danga.com</a><br>Message-ID: <<a href="mailto:4651A946.7020006@mysnip.de">
4651A946.7020006@mysnip.de</a>><br>Content-Type: text/plain; charset="iso-8859-1"<br><br>Hi Nathan,<br><br>I think thats simply up to the application how this is handled.<br>E.g. you could just "delete" or "update" the cached variable at the
<br>place where the data in the table is changed, thats<br>how we handle it in most areas.<br>Or you use some "version" which increases if the data changed and use<br>that version-number together with the key to retrieve
<br>data from memcached.<br><br><br>thomas<br><br>Nathan Nobbe schrieb:<br>> All,<br>><br>> I recently began investigating memcached, and im very excited about<br>> it. im planning on using it w/ php to implement variables whose
<br>> lifetime can be the duration of the application.<br>> I understand that storing the results of queries to the database can<br>> increase efficiency if those variables are checked for the data first<br>> on consecutive requests for the data they store, but
<br>> i still have a disconnect...<br>> what i dont understand is when the data profile of a particular table<br>> changes, and the variable in the memcache that represents that table<br>> becomes stale, how can the variable be updated efficiently?
<br>> obviously w/ php and a unix system, a simple cron could be used to<br>> poll the database periodically to see if there are changes to the data<br>> profile of a given table. i was thinking to make this even more
<br>> efficient; triggers could be employed (im using mysql 5+) to update a<br>> table, call it recent_tables_that_changed, dedicated to signifying<br>> particular tables in the database have changed. then the cron'd php
<br>> script could simply check recent_tables_that_changed to determine<br>> which, if any, application variables had become stale (do to a change<br>> in data profile). the stale variable could then be updated and the
<br>> record removed from recent_tables_that_changed.<br>> though decent, i am personally not a fan of this approach, because<br>> there would still be a frequent query running against the database<br>> just to determine what data had changed so that application variables
<br>> in the cache<br>> would not remain stale for long once theyve become stale.<br>> additionally, the mechanisms' responsiveness would be limited to the<br>> time granularity of cron, which i believe is a minute. im wondering
<br>> if there is some way to signal the cache only when tables, represented<br>> by application variables, have changed. if you dont feel like typing<br>> out a response, because this is probably a naive question, would
<br>> anyone mind directing me to a resource or two where i could read up on<br>> the topic myself?<br>><br>> (sorry for the lengthy posting)<br>> thanks,<br>><br>> -Nathan<br><br>-------------- next part --------------
<br>An HTML attachment was scrubbed...<br>URL: <a href="http://lists.danga.com/pipermail/memcached/attachments/20070521/bcf60a26/attachment-0001.html">http://lists.danga.com/pipermail/memcached/attachments/20070521/bcf60a26/attachment-0001.html
</a><br><br>------------------------------<br><br>Message: 4<br>Date: Mon, 21 May 2007 09:17:16 -0500<br>From: KevinImNotSpacey <<a href="mailto:kevin.amerson@gmail.com">kevin.amerson@gmail.com</a>><br>Subject: Re: telling code to pull from the database when the data in a
<br> table changes<br>To: "Nathan Nobbe" <<a href="mailto:quickshiftin@gmail.com">quickshiftin@gmail.com</a>><br>Cc: <a href="mailto:memcached@lists.danga.com">memcached@lists.danga.com</a><br>Message-ID:
<br> <<a href="mailto:68f7cf9d0705210717mf30e3f1s528fda9a2dd8f449@mail.gmail.com">68f7cf9d0705210717mf30e3f1s528fda9a2dd8f449@mail.gmail.com</a>><br>Content-Type: text/plain; charset="iso-8859-1"<br>
<br>Hey Nathan,<br><br>I think the appropriate solution is largely dependent on your particular<br>situation. For instance, we have one website that is media hosting, we<br>cache media requests for 10 minutes. Now if a user updates their media
<br>description or something we simply tell them that it will not show up on the<br>site right away. Then after roughly ten minutes the media expires from<br>cache, upon the next request our php code gets null back from memcached,
<br>gets the media from the database and disk, puts in memcache and then<br>returns.<br><br>So we don't use cron or any other batch processing, instead we figure that<br>stale for 10 minutes is ok and just let the content naturally expire from
<br>cache.<br><br>Hope this helps,<br>Kevin<br><br>On 5/21/07, Nathan Nobbe <<a href="mailto:quickshiftin@gmail.com">quickshiftin@gmail.com</a>> wrote:<br>><br>> All,<br>><br>> I recently began investigating memcached, and im very excited about it.
<br>> im planning on using it w/ php to implement variables whose lifetime can be<br>> the duration of the application.<br>> I understand that storing the results of queries to the database can<br>> increase efficiency if those variables are checked for the data first on
<br>> consecutive requests for the data they store, but<br>> i still have a disconnect...<br>> what i dont understand is when the data profile of a particular table<br>> changes, and the variable in the memcache that represents that table becomes
<br>> stale, how can the variable be updated efficiently?<br>> obviously w/ php and a unix system, a simple cron could be used to poll<br>> the database periodically to see if there are changes to the data profile of
<br>> a given table. i was thinking to make this even more<br>> efficient; triggers could be employed (im using mysql 5+) to update a<br>> table, call it recent_tables_that_changed, dedicated to signifying<br>> particular tables in the database have changed. then the cron'd php script
<br>> could simply check recent_tables_that_changed to determine which, if any,<br>> application variables had become stale (do to a change in data profile).<br>> the stale variable could then be updated and the record removed from
<br>> recent_tables_that_changed.<br>> though decent, i am personally not a fan of this approach, because there<br>> would still be a frequent query running against the database just to<br>> determine what data had changed so that application variables in the cache
<br>> would not remain stale for long once theyve become stale. additionally,<br>> the mechanisms' responsiveness would be limited to the time granularity of<br>> cron, which i believe is a minute. im wondering if there is some way to
<br>> signal the cache only when tables, represented by application variables,<br>> have changed. if you dont feel like typing out a response, because this is<br>> probably a naive question, would anyone mind directing me to a resource or
<br>> two where i could read up on the topic myself?<br>><br>> (sorry for the lengthy posting)<br>> thanks,<br>><br>> -Nathan<br>><br>-------------- next part --------------<br>An HTML attachment was scrubbed...
<br>URL: <a href="http://lists.danga.com/pipermail/memcached/attachments/20070521/32de3ddf/attachment.htm">http://lists.danga.com/pipermail/memcached/attachments/20070521/32de3ddf/attachment.htm</a><br><br>------------------------------
<br><br>_______________________________________________<br>memcached mailing list<br><a href="mailto:memcached@lists.danga.com">memcached@lists.danga.com</a><br><a href="http://lists.danga.com/mailman/listinfo/memcached">
http://lists.danga.com/mailman/listinfo/memcached</a><br><br><br>End of memcached Digest, Vol 34, Issue 42<br>*****************************************<br></blockquote></div><br>