title: Memtable & key cache confusion
body: <p>I'm reading rows from a CF using Hector with the default Cassandra cache settings.
  That means key cache is turned on. I am using jconsole to monitor the key cache hits.</p>
  
  <p>But even after reading a single row (by a primary key) a 100 times, the cache hits does not increase. The row had been updated recently.</p>
  
  <p>So when key cache is turned on what's the Cassandra read flow. Is it like this?</p>
  
  <ol>
  <li>The in-memory MemTable is checked for the row (could reside there after a recent insert/update).</li>
  <li>If not found in MemTable, the key cache is checked for the key.</li>
  <li>If key found (cache hit), one seek , else 2 seeks to get the row.</li>
  </ol>
  
  <p>But using <code>cassandra-cli</code> and <code>cassandra-jdbc</code> (CQL), I get different results.
  That is, even when I have updated the row recently, each read from the row results in a key cache hit. Say, I read it a 100 times, I get 100 hits.</p>
  
  <p>Why this discrepancy?</p>
  
  <p>Well i kind of figured this out myself, but would like someone to confirm..</p>
  
  <p>It looks like updates result in just fetching the column to be updated into the MemTable.
  So when i updated a row using hector, i had not updated all the columns. Just a column <code>x</code> and was reading the same column <code>x</code> for the read operation. So no cache hit as its already in MemTable.</p>
  
  <p>While running CQL , i was just running a <code>select * from cf</code> which resulted in fetching the other column <code>y</code> too. The column <code>y</code> had not been updated , so i am assuming it wouldn't have been in memory (MemTable) , hence resulting in the cache hit.</p>