Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions Connectors/src/Redis/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public async Task<IActionResult> Index(CancellationToken cancellationToken)
var model = new RedisViewModel
{
ConnectionString = _connectionMultiplexerConnector.Options.ConnectionString,
LuaResult = EvaluateLuaScript(database)
};

foreach (string keyName in keyNames.OrderBy(name => name))
Expand Down Expand Up @@ -75,21 +74,6 @@ private static async Task<List<string>> GetKeyNamesAsync(IConnectionMultiplexer
return value.ToString();
}

private static string EvaluateLuaScript(IDatabase database)
{
try
{
LuaScript script = LuaScript.Prepare("local val=\"Hello from Lua\" return val");
RedisResult result = database.ScriptEvaluate(script);

return result.ToString();
}
catch
{
return "Failed to execute Lua script, scripting is likely not enabled.";
}
}

public IActionResult Privacy()
{
return View();
Expand Down
1 change: 0 additions & 1 deletion Connectors/src/Redis/Models/RedisViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ public sealed class RedisViewModel

public IDictionary<string, string?> DistributedCacheData { get; set; } = new Dictionary<string, string?>();
public IDictionary<string, string?> ConnectionMultiplexerData { get; set; } = new Dictionary<string, string?>();
public string? LuaResult { get; set; }
}
11 changes: 1 addition & 10 deletions Connectors/src/Redis/Views/Home/Index.cshtml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@model Steeltoe.Samples.Redis.Models.RedisViewModel
@model Steeltoe.Samples.Redis.Models.RedisViewModel
@{
ViewData["Title"] = "Home Page";
}
Expand Down Expand Up @@ -63,13 +63,4 @@
}
</tbody>
</table>

<h4>Lua result</h4>
<table class="table table-bordered table-primary">
<tbody>
<tr>
<td>@Model.LuaResult</td>
</tr>
</tbody>
</table>
</div>
3 changes: 1 addition & 2 deletions Connectors/src/Redis/testing/linux.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ Feature: Connectors
When you push: manifest.yml
And you wait until CloudFoundry app redis-connector-sample is started
When you get https://redis-connector-sample/
Then you should see "Hello from Lua"
And you should see "redis-connector-sampleKeySetUsingMicrosoftApi1"
Then you should see "redis-connector-sampleKeySetUsingMicrosoftApi1"
And you should see "ValueSetUsingMicrosoftApi1"
And you should see "redis-connector-sampleKeySetUsingMicrosoftApi2"
And you should see "ValueSetUsingMicrosoftApi2"
Expand Down
3 changes: 1 addition & 2 deletions Connectors/src/Redis/testing/windows.feature
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ Feature: Connectors
And you push: manifest-windows.yml with args: -p bin/Release/net10.0/win-x64/publish
And you wait until CloudFoundry app redis-connector-sample is started
When you get https://redis-connector-sample/
Then you should see "Hello from Lua"
And you should see "redis-connector-sampleKeySetUsingMicrosoftApi1"
Then you should see "redis-connector-sampleKeySetUsingMicrosoftApi1"
And you should see "ValueSetUsingMicrosoftApi1"
And you should see "redis-connector-sampleKeySetUsingMicrosoftApi2"
And you should see "ValueSetUsingMicrosoftApi2"
Expand Down