Q:

find redis key by value zset - laravel

I have zset in redis like below.
Type:zset
TTL:does not expire [E]
Encoding:ziplist

Score                    Value
 1                     0358899056725255

13                    {"voltage_level":"06","signal_strength":"02"}

I have one device with dynamic ip on each connection with unique value (0358899056725255 here). When ever the device restart, its ip will be changed as a result i need to make a new zset . I want to delete all old garbage ip for this particular value.
What I treid
Redis::zadd($conn->remoteAddress, '01', $imei); //to add new ip
//scan all ip and check one by one 
@start loop
$val=Redis::zrangebyscore($ip[$i], 01, 01);
if($val=='0358899056725255')
  Redis::del($conn->remoteAddress);
@end loop

I have like 10,000+ devices and I dont want to iterate, is there some easy solutions

A:

I figured it out

Keep the expiry date on redis, which will be auto expired

 Redis::zadd($conn->remoteAddress, '01', $imei); //to add new ip
 Redis::expire($conn->remoteAddress, (60*60*24*30));

