I have written a script that gets paypals current rates compared with the dollar every hour (the currency my products are in by default).
The user can set their currency in their settings and that is store in the user table.
My initial idea was to store all the currencies rates in the database and then when the user logs in store the currency code and rate in their session. Then around each price I have a function that multiples the price by the users rate and appends the currency code on the end.
My only worry being is that the session variable may exist for sometime and could potentially make the price completely wrong.
Rather than store the rates in the session, should I just store their currency code and store the rates in a memory table or on the file system for fast access and have the price conversion function access it? So the prices are as up to date as the rates.
How is this normally achieved?