class MyDemoApp

Overview

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"

Defined in:

lose_the_ruby_accent.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(redis_client : AbstractRedisClientExpected) #

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

See AbstractRedisClientExpected for the required method definitions.


Instance Method Detail

def random_key_store : String #

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

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


def set_an_exact_value(key, value) : String #

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


def 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 😉