Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'd avoid trying to inject the caching into Zend_Db directly.</p> <p>What if you have one query you want to cache for 24 hours, and one you only want to cache for 60 seconds? How/where do you control that? Also you would need logic to make sure it only caches SELECT queries, otherwise you are wasting cache space.</p> <p>I would just use Zend_Cache using the adapter of your choice (libmemcached/apc/xcache for best performance) and handle the caching in your application or data access classes.</p> <p>You could use a hash of the query itself as the cache key, or depending on the query data, create hash functions for specific queries that are more easily identifiable. For example, if you had a query that just pulled user account details from the database, the cache key could be something like <code>userInfoQuery:1234</code> where 1234 is the user id.</p> <p><code>The query cache does not return stale data. When tables are modified, any relevant entries in the query cache are flushed.</code></p> <p>So if your tables change as a result of insert/update/delete, the query cache is cleared. If tables change frequently, then the query cache is not very helpful because it is short-lived.</p> <p>One other common thing you should do in production for Zend_Db is to cache the table meta data. As you have probably noticed, Zend issues DESCRIBE queries prior to insert(), find(), or info() queries. Using the table meta cache can eliminate these queries. See <a href="http://framework.zend.com/manual/en/zend.db.table.html#zend.db.table.metadata.caching" rel="nofollow">caching table metadata</a> for directions on how to do that.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

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