Note that there are some explanatory texts on larger screens.

plurals
  1. POyii caching and couchbase
    text
    copied!<p>need some help to clarify the concept.</p> <pre><code>$sql = 'SELECT * FROM tbl_post LIMIT 20'; $dependency = new CDbCacheDependency('SELECT MAX(update_time) FROM tbl_post'); $rows = Yii::app()-&gt;db-&gt;cache(1000, $dependency)-&gt;createCommand($sql)-&gt;queryAll(); </code></pre> <p>1.if the cache contains an entry indexed by the SQL statement.</p> <p>2.if the dependency has not changed (the maximum update_time value is the same as when the query result was saved in the cache).</p> <p>I do not understand what do the above explanation means. Especially second one with regards to maximum update_time. Please correct me if I am wrong.</p> <p>There is a update_time column in tbl_post table. Whenever a row is updated, the update_time is updated too. If a post is retrieved from the cache, CDbCacheDependency will first query the database for MAX(update_time)? What is the purpose of this and how exactly does it works in keeping the cache updated?</p> <p>Another question is regarding memcache. I understand that it is possible to cluster memcache servers. Say I have the below configurations.</p> <p>1 memcache server in US. 1 memcache server in Europe.</p> <p>My Yii website makes use of the cluster of 2 nodes. memcache will split the caching between the 2 nodes.</p> <p>1.user A retrieves a post from database and cached it. assume (123,$model) in US node.</p> <p>2.user B wants to retrieve the same post, from Europe. Will looking for key 123 finds the cache? Does it matters if both users are in US or Europe?</p> <p>Thanks!! </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload