Sha256: bc9ffca6b987cdb6e6ac760211a11a3294eda405b6e96ce31f3bc87b37f43ff7

Contents?: true

Size: 472 Bytes

Versions: 3

Compression:

Stored size: 472 Bytes

Contents

module RubyCAS::Server::Core::Tickets
  module CleanUp
    def self.cleanup(max_lifetime)
      transaction do
        conditions = ["created_at < ?", Time.now - max_lifetime]
        expired_tickets_count = count(:conditions => conditions)

        $LOG.debug("Destroying #{expired_tickets_count} expired #{self.name.demodulize}"+
          "#{'s' if expired_tickets_count > 1}.") if expired_tickets_count > 0

        destroy_all(conditions)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rubycas-server-activerecord-0.0.3 lib/rubycas/server/activerecord/model/clean_up.rb
rubycas-server-activerecord-0.0.2 lib/rubycas/server/activerecord/model/clean_up.rb
rubycas-server-activerecord-0.0.1 lib/rubycas/server/activerecord/model/clean_up.rb