MerbのCacheはなかなか優れた設計なので面白いのですが、
開発中にログにCache Miss/Hitの具合が分かるように出力してほしかったので、
development環境用のLoggingMemcachedStoreというのを書いてみました。

ruby>>
class LoggingMemcachedStore < Merb::Cache::MemcachedStore
include Extlib::Hook

before :read do |key, params|
if exists?(key, params)
Merb.logger.debug "Cache Hit: #{key}"
else
Merb.logger.debug "Cache Miss: #{key}"
end
end

before :write do |key, data, params, conds|
Merb.logger.debug "Cache Write: #{key}"
end
end
<<--

こんな感じでログに出ます。

pre>>
merb : worker (port 4000) ~ Cache Hit: Plugins#show
merb : worker (port 4000) ~ Cache Write: Plugins#show
<<--

posted by genki genki on Sat 21 Feb 2009 at 01:19 with 0 comments
Contents rssrss
光ファイバーを二次元振動させて走査するAR用ディスプレイ
因果の取り違え
Swift2's defer for CoffeeScript
mongodb-3.0からcreateIndexのdropDupsが無くなったらしい
mongodb-3.0以降のWiredTigerの設定を動的に変更する方法
一般楕円の高速生成アルゴリズムへの道標
farro mantecatoのレシピ
Droonga関連の記事のまとめ
RuntimeErrorの特定のメッセージに限定してrescueする方法
jQueryでscriptタグを実行せずにappendする
Tags
coffeescriptdefergroongajsmemonodenodejs
Comments rssrss
https://xn--krken21-bn4c.com https://xn--krken21-bn4c.com: Как отличить настоящий маркетплейс от подделки Kra... 05/01 12:20
https://example.com/xkkpsk https://example.com/xkkpsk: Great blog you have here.. It's difficult to find ... 05/01 09:31
https://onlinemo.ir https://onlinemo.ir: جمع‌بندی برای اون گروه از کاربرا که سیستم‌ها... 05/01 00:58
https://xn--mgmarkt9-9db.com https://xn--mgmarkt9-9db.com: Как обезопасить MEGA: настройка менеджера паролей ... 04/30 20:14
https://qeshmtourist.ir https://qeshmtourist.ir: در کل قضیه برای اونایی که می‌خوان وارد بشن س... 04/30 19:31
https://negarinadv.ir https://negarinadv.ir: سلام و عرض ادب، بنده مدتی قبل هنگام گشتن تو اینت... 04/30 18:56
https://gsmcharge.ir https://gsmcharge.ir: در کل قضیه برای کاربران علاقه‌مند به پلتفرم‌... 04/30 13:51
https://azardl.ir https://azardl.ir: در کل برای کاربرایی که در جستجو هستن پلتفرم‌... 04/30 02:42