Active Record 連線池 Reaper
每隔 frequency
秒,reaper 將在 pool
上呼叫 reap
和 flush
。一個以零頻率實例化的 reaper 永遠不會清除連線池。
透過在資料庫 YAML 檔案中設定 reaping_frequency
來設定頻率(預設值為 60 秒)。
方法
屬性
[R] | frequency | |
[R] | pool |
類別公開方法
new(pool, frequency) 連結
原始碼: 顯示 | 在 GitHub 上
# File activerecord/lib/active_record/connection_adapters/abstract/connection_pool/reaper.rb, line 19 def initialize(pool, frequency) @pool = pool @frequency = frequency end
實例公開方法
run() 連結
原始碼: 顯示 | 在 GitHub 上
# File activerecord/lib/active_record/connection_adapters/abstract/connection_pool/reaper.rb, line 71 def run return unless frequency && frequency > 0 self.class.register_pool(pool, frequency) end