@@ -11,6 +11,7 @@ import (
11
11
"time"
12
12
13
13
"github.com/redis/go-redis/v9/internal"
14
+ "github.com/redis/go-redis/v9/internal/hashtag"
14
15
)
15
16
16
17
// KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0,
@@ -1353,6 +1354,9 @@ func (c cmdable) Scan(ctx context.Context, cursor uint64, match string, count in
1353
1354
args = append (args , "count" , count )
1354
1355
}
1355
1356
cmd := NewScanCmd (ctx , c , args ... )
1357
+ if hashtag .Present (match ) {
1358
+ cmd .SetFirstKeyPos (3 )
1359
+ }
1356
1360
_ = c (ctx , cmd )
1357
1361
return cmd
1358
1362
}
@@ -1369,6 +1373,9 @@ func (c cmdable) ScanType(ctx context.Context, cursor uint64, match string, coun
1369
1373
args = append (args , "type" , keyType )
1370
1374
}
1371
1375
cmd := NewScanCmd (ctx , c , args ... )
1376
+ if hashtag .Present (match ) {
1377
+ cmd .SetFirstKeyPos (3 )
1378
+ }
1372
1379
_ = c (ctx , cmd )
1373
1380
return cmd
1374
1381
}
@@ -1382,6 +1389,9 @@ func (c cmdable) SScan(ctx context.Context, key string, cursor uint64, match str
1382
1389
args = append (args , "count" , count )
1383
1390
}
1384
1391
cmd := NewScanCmd (ctx , c , args ... )
1392
+ if hashtag .Present (match ) {
1393
+ cmd .SetFirstKeyPos (4 )
1394
+ }
1385
1395
_ = c (ctx , cmd )
1386
1396
return cmd
1387
1397
}
@@ -1395,6 +1405,9 @@ func (c cmdable) HScan(ctx context.Context, key string, cursor uint64, match str
1395
1405
args = append (args , "count" , count )
1396
1406
}
1397
1407
cmd := NewScanCmd (ctx , c , args ... )
1408
+ if hashtag .Present (match ) {
1409
+ cmd .SetFirstKeyPos (4 )
1410
+ }
1398
1411
_ = c (ctx , cmd )
1399
1412
return cmd
1400
1413
}
@@ -1408,6 +1421,9 @@ func (c cmdable) ZScan(ctx context.Context, key string, cursor uint64, match str
1408
1421
args = append (args , "count" , count )
1409
1422
}
1410
1423
cmd := NewScanCmd (ctx , c , args ... )
1424
+ if hashtag .Present (match ) {
1425
+ cmd .SetFirstKeyPos (4 )
1426
+ }
1411
1427
_ = c (ctx , cmd )
1412
1428
return cmd
1413
1429
}
0 commit comments