redislib

package
v2.2.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 23, 2019 License: Apache-2.0 Imports: 0 Imported by: 0

README

Examples for cn-infra/db/keyval/redis

Get Started

To run these examples, you must have access to a Redis installation, either locally or remotely.

You can download docker images from:

Modify API configuration to match your environment. See sample configurations to use with the API here:

Simple Example

  • Straight API calls, no particular scenario
  • Also, look at the function generateSampleConfigs() which shows how to generate and save each type of client configurations.

To start the example, 'cd' to cn-infra/db/keyval/redis/examples directory. Run

go run simple/simple.go -redis-config=<redis client config yaml>

Airport Example

  • Simulates airport operations with four functional modules - arrival, departure, runway and hangar
  • Communicates and updates flight info through Redis.
  • Displays flight status, live.

diagram.png


To start the example, 'cd' to cn-infra/db/keyval/redis/examples directory. Run

go run airport/airport.go -redis-config=<redis client config yaml>

Known Issues

  • When working with Redis Cluster:

    Redis Multi-key commands, like MGET, KEYS, SCAN, PUBSCRIBE...etc. do not work unless all keys involved belong to the same hash slot. This API uses all of these commmands. If you have to use Redis Cluster, you can force all keys to be stored in the same hash slot by using "hash tag".

Documentation

Overview

Package redislib contains a collection of examples demonstrating the usage of the redis library.

Directories

Path Synopsis
A bit more advanced example demonstrating the redis library API.
A bit more advanced example demonstrating the redis library API.
model
Package flight defines protobuf-formatted data as used by the airport example.
Package flight defines protobuf-formatted data as used by the airport example.
A simple example demonstrating the redis library API.
A simple example demonstrating the redis library API.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL