Class: WebCrawlerRequest

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
CachedCounting
Defined in:
app/models/web_crawler_request.rb

Constant Summary

Constants included from CachedCounting

CachedCounting::COUNTER_REDIS_HASH, CachedCounting::DB_COOLDOWN_KEY, CachedCounting::DB_FLUSH_COOLDOWN_SECONDS, CachedCounting::ENSURE_THREAD_COOLDOWN_SECONDS, CachedCounting::FLUSH_DB_ITERATIONS, CachedCounting::LUA_HGET_DEL, CachedCounting::MUTEX, CachedCounting::QUEUE, CachedCounting::SLEEP_SECONDS

Class Method Summary collapse

Methods included from CachedCounting

allowed_to_flush_to_db?, clear_flush_to_db_lock!, clear_queue!, disable, enable, enabled?, ensure_thread!, flush, flush_in_memory, flush_to_db, flush_to_db_lock_ttl, queue, reset, thread_loop

Class Method Details

.increment!(user_agent) ⇒ Object



14
15
16
# File 'app/models/web_crawler_request.rb', line 14

def self.increment!(user_agent)
  perform_increment!(user_agent)
end

.write_cache!(user_agent, count, date) ⇒ Object



18
19
20
21
22
# File 'app/models/web_crawler_request.rb', line 18

def self.write_cache!(user_agent, count, date)
  where(id: request_id(date: date, user_agent: user_agent)).update_all(
    ["count = count + ?", count],
  )
end