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

More rubust cache keys #156

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

morloderex
Copy link
Contributor

@morloderex morloderex commented Jun 23, 2023

When determining a cache key and stating that the ttl for the query should be now until for instance the end of day. We have a little tiny bug in that the sha1 key will ALWAYS be different sense ttl value is stored alongside the cache key. Use to the serialization of the object.

This pr fixes that by being more explicit about how the sha1 value is created now instead of serializing the whole exchangeQuery object we take out the specific parameters which we know are constants.

E.g the base and counter currency and for historical fetches we also take out the date in Y-m-d format

When determining a cache key and stating that the ttl for the query should be now until for instance the end of day. We have a little tiny but in that the sha1 key will ALWAYS be different sense ttl value is stored along side the cache key. Use to the serialization of the object.

This pr fixes that.
@florianv
Copy link
Owner

florianv commented Nov 3, 2023

@morloderex Thanks for your PR :) I would maybe instead introduce a CacheResolver so everyone could customize the strategy based on their caching needs and pass it as a constructor param to Exchanger, with the default resolver being the current one to keep B/C

@morloderex
Copy link
Contributor Author

@florianv thanks for your feedback.
That's a great idea, i will make the changes for that one. But would you consider it as a breaking change if i change the constructor?

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.

2 participants