I wrote a script that receives current Paypals rates compared to the dollar every hour (the currency at which my products are by default).
The user can set his currency in his settings and store in the user table.
My initial idea was to store all currency rates in a database, and then when the user registers the currency code and exchange rate in his session. Then, around each price, I have a function that multiplies the price by the user's speed and adds a currency code to the end.
My only concern is that the session variable may exist at some point and could potentially make the price completely wrong.
Instead of storing bids in a session, I just have to save my currency code and save the bids in the memory table or in the file system for quick access and access the price conversion function? Thus, prices are as modern as rates.
How is this usually achieved?
source
share