Thursday, November 11, 2010

Rails Application variable II

Ah, it turns out that my heist and ignorance in Ruby and Rails I missed out on the Rails.cache options.
All you need is...


  def self.alive? (id)
    if Rails.cache.read(id)!=nil and (Time.now - Rails.cache.read(id))<10
      true
    else
      Rails.cache.delete(id)
      false
    end
   
  end
 
  def self.present(id)
    Rails.cache.write(id,Time.now)
  end

(...love)

No comments:

Post a Comment

Please do not post spam on this blog, Spam sites will be reported to google.
thank you kindly.