Module Expirable
In: lib/more/facets/expirable.rb

Generic expirability mixin.

Methods

Attributes

expires  [RW] 

Public Instance methods

Is this entry expired?

[Source]

    # File lib/more/facets/expirable.rb, line 40
40:   def expired?
41:     if @expires.nil? or (Time.now > @expires)
42:       return true
43:     else
44:       return false
45:     end
46:   end

Set the expires timeout for this entry.

[Source]

    # File lib/more/facets/expirable.rb, line 27
27:   def expires_after(timeout = (60*60*24))
28:     @expires = Time.now + timeout
29:   end

Set the expire timeout for this entry. The timeout happens after (base + rand(spread)) seconds.

[Source]

    # File lib/more/facets/expirable.rb, line 34
34:   def expires_spread(base, spread)
35:     @expires = Time.now + base + rand(spread)
36:   end

Update the expiration period. Override in your application.

[Source]

    # File lib/more/facets/expirable.rb, line 50
50:   def touch!
51:   end

[Validate]