Memmo is a small library for creating key-based, in-memory caches in Ruby.
It features thread safety and TTLs.
require"memmo"
$memmo =Memmo.new
$memmo.register(:popular_posts,ttl: 60)do# Somewhat expensive queryPost.find(...)end# This call will trigger a miss and will run our expensive query.
$memmo[:popular_posts].eachdo |post|
puts(post)end# This call will be fast for the next 60 seconds.
$memmo[:popular_posts]It's common to avoid caches when testing your application. For this purpose you can disable Memmo entirely:
require"test/unit"Memmo.enabled=falseSee UNLICENSE. With love, from Educabilia.

