Last active
May 21, 2017 14:01
-
-
Save yumu19/42c3bd55afa137f378b90abb4d73a7cb to your computer and use it in GitHub Desktop.
Sample C# Script File with TeamDev.Redis for Unity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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