Skip to content

Commit 27dfa85

Browse files
committed
Replace deprecated RPOPLPUSH with LMOVE and add compatibility notes
- Replace RPOPLPUSH with LMOVE (Redis 6.2+) in DequeueId.lua since RPOPLPUSH is deprecated and may be removed in a future Redis version - Add NOTE to RemoveIfEqual.lua and ReplaceIfEqual.lua about replacing with native CAS/CAD commands (SET IFEQ / DEL IFEQ) when Redis 8.4+ becomes the minimum supported version - Add NOTE to Dispose() methods in RedisCacheClient, RedisFileStorage, and RedisQueue about implementing IAsyncDisposable when Foundatio base interfaces add support - Update StackExchange.Redis to 2.13.1 for RESP3 default on AMR
1 parent ae0b86b commit 27dfa85

9 files changed

Lines changed: 16 additions & 6 deletions

File tree

build/common.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
</PropertyGroup>
3939

4040
<ItemGroup>
41-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="10.0.203" PrivateAssets="All"/>
41+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="10.0.300" PrivateAssets="All"/>
4242
<PackageReference Include="AsyncFixer" Version="2.1.0" PrivateAssets="All" />
4343
<PackageReference Include="MinVer" Version="7.0.0" PrivateAssets="All" />
4444
</ItemGroup>

samples/Foundatio.SampleJob/Foundatio.SampleJob.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
</ItemGroup>
1111
<ItemGroup>
1212
<PackageReference Include="Exceptionless.RandomData" Version="2.0.1" />
13-
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="10.0.7" />
13+
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="10.0.8" />
1414
</ItemGroup>
1515
</Project>

src/Foundatio.Redis/Cache/RedisCacheClient.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,6 +1010,8 @@ private void ConnectionMultiplexerOnConnectionFailed(object? sender, ConnectionF
10101010
_logger.LogWarning("Redis connection failed: {FailureType}", connectionFailedEventArgs.FailureType);
10111011
}
10121012

1013+
// NOTE: Implement IAsyncDisposable when Foundatio's ICacheClient interface adds support for it.
1014+
// IConnectionMultiplexer supports IAsyncDisposable since SE.Redis 2.6.66.
10131015
public void Dispose()
10141016
{
10151017
if (_isDisposed)

src/Foundatio.Redis/Foundatio.Redis.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<PackageReference Include="Foundatio" Version="13.0.1" Condition="'$(ReferenceFoundatioSource)' == '' OR '$(ReferenceFoundatioSource)' == 'false'" />
55
<ProjectReference Include="..\..\..\Foundatio\src\Foundatio\Foundatio.csproj" Condition="'$(ReferenceFoundatioSource)' == 'true'" />
66

7-
<PackageReference Include="StackExchange.Redis" Version="2.12.14" />
7+
<PackageReference Include="StackExchange.Redis" Version="2.13.1" />
88
</ItemGroup>
99
<ItemGroup>
1010
<EmbeddedResource Include="Scripts\*.lua" />

src/Foundatio.Redis/Queues/RedisQueue.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -805,6 +805,8 @@ private LoadedLuaScript GetScript(LoadedLuaScript? script)
805805
return script ?? throw new QueueException("Lua scripts not loaded. Call LoadScriptsAsync first.");
806806
}
807807

808+
// NOTE: Implement IAsyncDisposable when Foundatio's IQueue interface adds support for it.
809+
// IConnectionMultiplexer supports IAsyncDisposable since SE.Redis 2.6.66.
808810
public override void Dispose()
809811
{
810812
base.Dispose();

src/Foundatio.Redis/Scripts/DequeueId.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
local item = redis.call('RPOPLPUSH', @queueListName, @workListName);
1+
local item = redis.call('LMOVE', @queueListName, @workListName, 'RIGHT', 'LEFT');
22
if item then
33
local dequeuedTimeKey = @listPrefix .. ':' .. item .. ':dequeued';
44
local renewedTimeKey = @listPrefix .. ':' .. item .. ':renewed';

src/Foundatio.Redis/Scripts/RemoveIfEqual.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
if redis.call('get', @key) == @expected then
1+
-- NOTE: When Redis 8.4+ becomes the minimum supported version, this script can be replaced
2+
-- with native CAS/CAD: DEL @key IFEQ @expected (SE.Redis 2.10.1+ supports this via ValueCondition).
3+
if redis.call('get', @key) == @expected then
24
return redis.call('del', @key)
35
else
46
return 0

src/Foundatio.Redis/Scripts/ReplaceIfEqual.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
local currentVal = redis.call('get', @key)
1+
-- NOTE: When Redis 8.4+ becomes the minimum supported version, this script can be replaced
2+
-- with native CAS/CAD: SET @key @value IFEQ @expected [PX @expires] (SE.Redis 2.10.1+ supports this via ValueCondition).
3+
local currentVal = redis.call('get', @key)
24
if (currentVal == false or currentVal == @expected) then
35
if (@expires ~= nil and @expires ~= '') then
46
return redis.call('set', @key, @value, 'PX', @expires) and 1 or 0

src/Foundatio.Redis/Storage/RedisFileStorage.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ public RedisFileStorage(Builder<RedisFileStorageOptionsBuilder, RedisFileStorage
4747
ISerializer IHaveSerializer.Serializer => _serializer;
4848
public IDatabase Database => _connectionMultiplexer.GetDatabase();
4949

50+
// NOTE: Implement IAsyncDisposable when Foundatio's IFileStorage interface adds support for it.
51+
// IConnectionMultiplexer supports IAsyncDisposable since SE.Redis 2.6.66.
5052
public void Dispose()
5153
{
5254
_connectionMultiplexer.ConnectionRestored -= ConnectionMultiplexerOnConnectionRestored;

0 commit comments

Comments
 (0)