Skip to content

elcuervo/cachoo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cachoo

Expirable memoization of methods

Installation

gem install cachoo

Usage

class Cache
  extend Cachoo

  def now
    Time.now.utc
  end
  cachoo :now # :now gets cached for 5 seconds by default
end
class Cache
  extend Cachoo

  def now
    Time.now.utc
  end
  cachoo :now, for: 60*60 # :now get cached for 1 hour
end

You can also ahange the time globally:

Cachoo.for = 60*60*24 # 1 day cache

Why?

I hate manually expiring memoization

Name

It's an invented word betweeh cache and achoo :)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages