Skip to content
Peter Goldstein edited this page Nov 15, 2021 · 1 revision

To get started with Dalli, you will need to:

  1. Ensure you have a supported Ruby version installed
  2. Run gem install dalli to install Dalli from Rubygems
  3. Install memcached locally and verify that it is running

Once you've completed these steps, you should be able to run the following Ruby script:

require 'dalli'
options = { namespace: "app_v1" }
dc = Dalli::Client.new('localhost:11211', options)
dc.set('abc', 123)
from_cache = dc.get('abc')

If everything is set up correctly, you should find that from_cache has the value 123. Try it yourself.