Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adding ability to get all keys matching a specific pattern. Added functions to construct the service and template keys #94

Merged
merged 4 commits into from
Jul 27, 2021

Conversation

Moro-Code
Copy link
Contributor

@Moro-Code Moro-Code commented Jul 26, 2021

Summary | Résumé

To reduce duplication I added additional functions to generate the template and service key patterns.

Test instructions | Instructions pour tester la modification

Run unit tests !

Help requested | Aide requise

N/A

Reviewer checklist | Liste de vérification du réviseur

This is a suggested checklist of questions reviewers might ask during their
review | Voici une suggestion de liste de vérification comprenant des questions
que les réviseurs pourraient poser pendant leur examen :

  • Does this meet a user need? | Est-ce que ça répond à un besoin utilisateur?
  • Is it accessible? | Est-ce que c’est accessible?
  • Is it translated between both offical languages? | Est-ce dans les deux
    langues officielles?
  • Is the code maintainable? | Est-ce que le code peut être maintenu?
  • Have you tested it? | L’avez-vous testé?
  • Are there automated tests? | Y a-t-il des tests automatisés?
  • Does this cause automated test coverage to drop? | Est-ce que ça entraîne
    une baisse de la quantité de code couvert par les tests automatisés?
  • Does this break existing functionality? | Est-ce que ça brise une
    fonctionnalité existante?
  • Should this be split into smaller PRs to decrease change risk? | Est-ce
    que ça devrait être divisé en de plus petites demandes de tirage (« pull
    requests ») afin de réduire le risque lié aux modifications?
  • Does this change the privacy policy? | Est-ce que ça entraîne une
    modification de la politique de confidentialité?
  • Does this introduce any security concerns? | Est-ce que ça introduit des
    préoccupations liées à la sécurité?
  • Does this significantly alter performance? | Est-ce que ça modifie de
    façon importante la performance?
  • What is the risk level of using added dependencies? | Quel est le degré de
    risque d’utiliser des dépendances ajoutées?
  • Should any documentation be updated as a result of this? (i.e. README
    setup, etc.) | Faudra-t-il mettre à jour la documentation à la suite de ce
    changement (fichier README, etc.)?

…ed functions to construct the service and template keys
Copy link
Member

@jimleroyer jimleroyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor correction requested for renaming regex parameter to some other matching name. Also, the test might not correspond to the usage expectations.



def service_cache_key(service_id):
return f"service-{service_id}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍



def test_should_call_get_cache_keys_by_pattern_if_enabled(mocked_redis_client):
assert mocked_redis_client.get_cache_keys_by_pattern("test-key-*") == [b"test-1243", b"test-23423423"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the parameter is a regular expression, I would not expect these keys to get returned as they would not fix test-key-*. A proper regex for the expected keys would be test-[\d]+. My impression is that the parameter format correspond more to a glob than a regex.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're probably right. It turns our I do not need this function anyways to make it work. So I removed it

@Moro-Code Moro-Code merged commit 505996b into master Jul 27, 2021
@Moro-Code Moro-Code deleted the adding-get-cached-keys-method-to-redis-client branch July 27, 2021 20:07
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.

None yet

2 participants