You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 21, 2022. It is now read-only.
ObjectReceiverを繰り返し呼ぶと、同じモデルに大量のSQLが発行されてしまう。どこかにモデルインスタンスをキャッシュする仕組みなどを作って改善する。
案1)
Model::findOrFailWithCacheみたいなメソッドを作って、それから取った場合はキャッシュされているインスタンスがあればそれが取れるようにする。
(saveWithCacheで仮保存。)
CustomDB::transaction みたいなものでくるんで、transactionが終わったタイミングで本当のsaveする。
→ 欠点: scopeやらwhereやらModelのいろんなfindが使えなくなる。インスタンスを更新したけど保存しない場合など、何か対策しないと事故る。
案2)
案1と同じだが、ObjectReceiverにインスタンスを管理させる。影響範囲は小さい。
→ 欠点: ObjectReceiver系の処理がそこだけ独自の世界になってしまう。
The text was updated successfully, but these errors were encountered: