edit-icon download-icon

Ruby code sample

Last Updated: Dec 21, 2017

Environment configuration

Dependent on Ruby1.9.3 or later.

Installation steps

  1. Install RubyGems.

  2. Run gem install dalli. (Make sure to use version 2.7.3 or later. Otherwise, there will be authentication failures.)

Code example

  1. require 'dalli'
  2. options = { :username => username', :password => ‘password' } #"username" indicates the instance ID in "Instance details" of " Basic information" on the console, while "password" indicates the password set through the "Changing password" function.
  3. dc = Dalli::Client.new('ip:port', options) #"ip" indicates the Intranet address in "Instance details" of "Basic information" on the console, while "port" indicates the port number in "Instance details" of "Basic information".
  4. dc.set('key', value')
  5. value = dc.get(‘key')
Thank you! We've received your feedback.