[TSM.ID].[11031972] PXE : Platform X Ecosystem I [118 Module -LIVE-]
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
import Redis from 'ioredis';
|
||||
export const redis = new Redis(process.env.REDIS_URL || 'redis://localhost:6379');
|
||||
export async function getExchangeRate() {
|
||||
const cache = await redis.get('usd_idr_rate');
|
||||
if (cache) return parseFloat(cache);
|
||||
const rate = 15500;
|
||||
await redis.set('usd_idr_rate', rate, 'EX', 43200);
|
||||
return rate;
|
||||
}
|
||||
Reference in New Issue
Block a user