fetlife/rollout

Public Interface for deleting feature entries from Redis

PhilCoggins opened this issue · 2 comments

When I have completed beta development for a feature and no longer need to reference the feature in Redis from my application, I don't want that entry to hang around in Redis forever. I can easily delete the entry from Redis CLI, but it seems like there should be a public interface to delete the feature from Redis $rollout.delete(:old_feature_rolled_out_years_ago).

Is there a reason this was omitted?

@PhilCoggins There is an existing delete function:

Before I did anything (blank slate):

[1] pry(main)> $rollout.get :old_feature_rolled_out_years_ago
=> #<Rollout::Feature:0x00007fd4951e6a88 @data={}, @groups=[], @name=:old_feature_rolled_out_years_ago, @options={}, @percentage=0, @users=[]>

Activate for a group, and re-get to see changes:

[2] pry(main)> $rollout.activate_group :old_feature_rolled_out_years_ago, :employees
=> "OK"
[3] pry(main)> $rollout.get :old_feature_rolled_out_years_ago
=> #<Rollout::Feature:0x00007fd493fa9550
 @data={},
 @groups=[:employees],
 @name=:old_feature_rolled_out_years_ago,
 @options={},
 @percentage=0.0,
 @users=[]>

Delete the feature and re-get:

[4] pry(main)> $rollout.delete :old_feature_rolled_out_years_ago
=> 1
[5] pry(main)> $rollout.get :old_feature_rolled_out_years_ago
=> #<Rollout::Feature:0x00007fd49490c980 @data={}, @groups=[], @name=:old_feature_rolled_out_years_ago, @options={}, @percentage=0, @users=[]>
[6] pry(main)>

Are you seeing different results?

Oh wow, I'm on an old gem version, looks like delete was added four years ago 🤦‍♂️ .