Skip to content

Instantly share code, notes, and snippets.

@yumu19
Last active May 21, 2017 14:01
Show Gist options
  • Save yumu19/42c3bd55afa137f378b90abb4d73a7cb to your computer and use it in GitHub Desktop.
Save yumu19/42c3bd55afa137f378b90abb4d73a7cb to your computer and use it in GitHub Desktop.
Sample C# Script File with TeamDev.Redis for Unity
// Working on Unity 5.6.1f1
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TeamDev.Redis;
public class RedisKeysSample : MonoBehaviour {
private RedisDataAccessProvider redis;
private string[] keys;
void Start () {
redis = new RedisDataAccessProvider ();
redis.Configuration.Host = "127.0.0.1";
redis.Configuration.Port = 6379;
redis.Connect ();
redis.SendCommand (RedisCommand.KEYS, "*");
keys = redis.ReadMultiString ();
for (int i = 0; i < keys.Length; i++) {
redis.SendCommand (RedisCommand.GET, keys [i]);
string value = redis.ReadString ();
Debug.Log(i.ToString()+" "+ keys[i] + ":" + value);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment