StackExchange / StackExchange.Redis

General purpose redis client
https://stackexchange.github.io/StackExchange.Redis/
Other
5.87k stars 1.51k forks source link

RedisKey WithPrefix usage #2309

Open hrrrrustic opened 1 year ago

hrrrrustic commented 1 year ago

Redis + operator is obsoleted with message to use WithPrefix method https://github.com/StackExchange/StackExchange.Redis/blob/84766514b0af2d24ba4273506b389c1992ef382b/src/StackExchange.Redis/RedisKey.cs#L313-L315

But the method is internal https://github.com/StackExchange/StackExchange.Redis/blob/84766514b0af2d24ba4273506b389c1992ef382b/src/StackExchange.Redis/RedisKey.cs#L317

Am I missing something or there is no way to use prefix logic without supressing obsolete warning?

NickCraver commented 1 year ago

You'll want to use .WithPrefix() on IDatabase which handles all this internally - I'll leave this until until we update the message to be clearer :)

hrrrrustic commented 1 year ago

You'll want to use .WithPrefix() on IDatabase which handles all this internally - I'll leave this until until we update the message to be clearer :)

Thanks. I also found Prepend method (it's public) that just pass call to WithPrefix. Might be reasonable to add it to the message too