Project

cachoo

0.0
No commit activity in last 3 years
No release in over 3 years
A quick and dirty way to expire memoization
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 1.2.1
 Project Readme

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 :)