This repository was archived by the owner on Feb 28, 2020. It is now read-only.

Description
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:
djmoney_rates.utils.get_rate = memoize(djmoney_rates.utils.get_rate)
djmoney_rates.utils.get_rate_source = memoize(djmoney_rates.utils.get_rate_source)
Let me know if you have any thoughts or questions.
Thanks,
Mike