class

MyDemoApp

Inherits Reference < Object

This is the class for my demo app! :)

The MyDemoApp is the primary entry point for using this library, it requires a redis client that inherits from AbstractRedisClientExpected to be passed in at the time of initialization.

require "./my_demo_app"

class MyRedisClient < AbstractRedisClientExpected
  property cache : Hash(String, String) = {} of String => String

  def get(key : String) : String
    @cache[key]
  end

  def set(key : String, value : String)
    @cache[key] = value
    key
  end
end

my_app = MyDemoApp.new(redis_client: MyRedisClient.new)
my_app.random_key_store # => "some_random_key"

Constructors

new(redis_client : AbstractRedisClientExpected)

This expects a class that represents some kind of redis client.

See AbstractRedisClientExpected for the required method definitions.

Source

Instance methods

random_key_store

This will let you set a random key/value pair.

Why not? 🤷‍♂️ It's a demo after all! 😁

Source
set_an_exact_value(key, value) : String

This will let you set an exact key/value pair.

Source
what_was_that?(key) : String

Use this method if you forgot the value that was stored for a key.

This won't help if you've forgotten your key 😉

Source