Skip to content

Conversation

andrehjr
Copy link
Member

When persisting a list several calls are being made to ensure that each element gets the correct index.

Instead of dealing with that on a single MULTI call, we push all elements to a tmp list, and that gets renamed it right after, using RENAME overwriting the previous list.

Also, this is only called on new experiments, and whenever an experiment configuration has changed.

Before:

  • N RPUSH calls would be made.
  • N LSET calls would be made, depending on the scenario.
  • 1 extra LTRIM

Now:

  • Single RPUSH with all the alternatives O(n) where n is the number of elements
  • 1 RENAME O(1).

Also removing one extra SISMEMBER check when calling RedisInterface#add_to_set.

@andrehjr andrehjr force-pushed the simplify-redis-interface branch from 686cda3 to 7b9caf5 Compare June 22, 2020 01:49
@andrehjr andrehjr merged commit 7ec1015 into master Jun 22, 2020
@andrehjr andrehjr deleted the simplify-redis-interface branch July 5, 2020 01:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant