using System.Collections.Generic;
public static void Main()
var engine = new RedisEngine();
Console.WriteLine("END");
public Dictionary<string, int> entries = new Dictionary<string, int>();
public readonly Stack<Dictionary<string, int>> transactions = new Stack<Dictionary<string, int>>();
public bool SET(string key, int value)
if (!this.entries.ContainsKey(key))
this.entries.Add(key, value);
this.entries[key] = value;
public int? GET(string key)
if (this.entries.ContainsKey(key))
Console.WriteLine(this.entries[key]);
return this.entries[key];
Console.WriteLine("NULL");
public bool UNSET(string key)
if (this.entries.ContainsKey(key))
this.entries.Remove(key);
public int NUMEQUALTO(int value)
var count = this.entries.Count(x => x.Value == value);
Console.WriteLine(count);
transactions.Push(new Dictionary<string, int>(entries));
if (transactions.Count > 0)
entries = transactions.Pop();
Console.WriteLine("NO TRANSACTION");