2011年3月8日星期二

Re: [fw-db] Programmatically Clear Metadata Cache?

Thanks for your helpful reply. Hopefully I can figure out how to call that
$table->getDefaultMetadataCache()->clean() at the right time / in the right
context.

-JB

________________________________
From: Саша Стаменковић <umpirsky@gmail.com>
To: JBChristy <JBChristy@pacbell.net>
Cc: fw-db@lists.zend.com
Sent: Mon, March 7, 2011 10:57:20 PM
Subject: Re: [fw-db] Programmatically Clear Metadata Cache?

You can set table metadata cache with

$cache = Zend_Cache::factory(...);
Zend_Db_Table_Abstract::setDefaultMetadataCache($cache);

and clear cache with

$cache->clean(...);

when the metadata changes.

---
Regards,
Saša Stamenković

On Mon, Mar 7, 2011 at 10:40 PM, JBChristy <JBChristy@pacbell.net> wrote:

I've just up automatic (mem)caching of all Zend_DB_Table's. From time to
>time, of course, the metadata changes. We do this in our production
>environment by running sql scripts that add / drop / change columns as
>necessary. I need some programmatic way to expire the metadata cache after
>the sql runs, and no later than when updated code goes live, which is a
>matter of minutes. I can't just wait til it times out.
>
>I've dug into Zend 1.11 Zend_Db_Table_Abstract, and the memcache key is an
>md5 encoding of an optional port, optional host, dbname, schema name and
>table name. There does not appear to be member function to expire the cache,
>nor even a function to return the md5 encoded key so I can delete it
>manually.
>
>How are we supposed to clear the metadata cache when the metadata changes?
>
>Thanks in advance for your help!
>
>--
>View this message in context:
>http://zend-framework-community.634137.n4.nabble.com/Programmatically-Clear-Metadata-Cache-tp3340068p3340068.html
>
>Sent from the Zend DB mailing list archive at Nabble.com.
>

1 条评论:

mike 说...

很好 很喜欢这个帖子
好,应该顶,今后继续努力
我见过的最好的帖子了,谢谢楼主
有意义,有收获,谢谢提供
挺好,很实用
帖子不错,多谢楼主分享心得
痘痘