This repository has been archived by the owner on Feb 28, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 60
Caching of rates lookup. #5
Comments
+1 to this. Mike - can you share the memoize function are you using? Thanks, |
Hi Dave, We our own version of Regards, |
We are doing the same: Our cache function, which uses the Django cache backend but is generic for all kinds of functions:
The monkey patch:
It's difficult to know exactly how this functionality should be integrated into django-money-rates. |
8 tasks
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Currently at least 2 database queries are performed for each currency conversion. This means that using django-money-rates for some tasks becomes infeasible, for example converting a large number of money amounts into a canonical currency so that they can be sorted according to true value.
With the current setup where rates are updated via a cronjob I don't think there would be a particular disadvantage in caching the results for 60s however possibly a more robust solution would be to use a configurable rates source backend which could be over-ridden to allow someone to add whatever caching logic they require.
At the moment I'm simply monkey patching the relevant functions:
Let me know if you have any thoughts or questions.
Thanks,
Mike
The text was updated successfully, but these errors were encountered: