A month ago I stumbled upon a problem: I wasn���t able to find a Ruby gem which would do in-memory caching with the capability to expire on timeout. After some quick research I decided to implement my own and called it Zache (as in ���zero cache,��� since there is no back end). Here is how it works:
First, you create the cache:
require 'zache' zache = Zache.new
Then you fetch the value by the key, also providing the block which will be executed if the key is absent or expired:
x = za...
Published on February 04, 2019 16:00