Class: Orchestrator::AccessLog

Inherits:
Couchbase::Model
  • Object
show all
Includes:
CouchbaseId::Generator
Defined in:
app/models/orchestrator/access_log.rb

Constant Summary collapse

TTL =
Rails.env.production? ? 2.weeks.to_i : 120

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ AccessLog

Returns a new instance of AccessLog.



23
24
25
26
27
28
29
# File 'app/models/orchestrator/access_log.rb', line 23

def initialize(*args)
    super(*args)

    if self.created_at.nil?
        self.created_at = Time.now.to_i
    end
end

Instance Method Details

#saveObject



31
32
33
34
35
36
37
38
39
# File 'app/models/orchestrator/access_log.rb', line 31

def save
    self.last_checked_at = Time.now.to_i

    if self.persisted
        super
    else
        super(ttl: TTL)
    end
end