Sha256: f938aebdd8e3cfd5a38976980df05d4b69f40838d22ac58589f24fa8b78a6a82
Contents?: true
Size: 822 Bytes
Versions: 3
Compression:
Stored size: 822 Bytes
Contents
# NOT USED YET module RubyCAS::Server::Core module Consumable def consume! self.consumed = Time.now self.save! end def self.included(mod) mod.extend(ClassMethods) end module ClassMethods def cleanup(max_lifetime, max_unconsumed_lifetime) transaction do conditions = ["created_on < ? OR (consumed IS NULL AND created_on < ?)", Time.now - max_lifetime, Time.now - max_unconsumed_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 end
Version data entries
3 entries across 3 versions & 1 rubygems