Software consulting and development in and around Oshawa, Durham Region and the Greater Toronto Area of Ontario


A simple Ruby library for caching the results of a call to any method or function call.

Great for speeding up program execution for when making long calls to things like web services.


Install from the command line

# gem install callcache


The following will call exp_fun and print out the results of the call. The result will be stored in a file cache, and the next time the same call is made, the cached results will be returned.

require 'call_cache'

def exp_fun( start_num, end_num )
    ret_val = 1
    start_num.upto( end_num ) do |num|
        ret_val = ret_val * num
    return ret_val.to_s.size

blog_source = 'Net::HTTP.get', :pars => [URI.parse('')] );

p blog_source.size
p 'exp_fun', :pars => [1, 10000], :options => {:ttl => 10})


Download from Google Code