danielbrendel / steamwidgets-web

SteamWidgets Web Backend
https://www.steamwidgets.net
MIT License
3 stars 2 forks source link

Steam API Caching? #16

Open SophiaAtkinson opened 10 months ago

SophiaAtkinson commented 10 months ago

This is a sort of request/question. Would an API cache be in the scope of work soon?

As API calls for https://example.com/api/query/app?appid=GAME&lang=english can take upwards of 1.5 to 2 Seconds to complete, and then this is all done staggered in the waterfall it is jarring to visitors.

Most of this is due to the Steam Community API being complete garbage. But with Steam API response being JSON, they could in theory be cached

opera_evhyX4IVND

danielbrendel commented 10 months ago

Caching was not on my to-do list before, but this sounds like a nice idea. I'll check this out soon and see if this will improve the performance significantly. Thank you for your suggestion.

SophiaAtkinson commented 3 months ago

As an update, I got bored and made a working prototype using Redis, I will be adding support for other KV store applications like Memcached I Will work on a PR later next month.

opera_LCz843QpWB.gif

danielbrendel commented 3 months ago

Hi @SophiaAtkinson, that's great! I am really looking forward to your PR!

I am currently considering to relaunch the project. Tho the original .com domain was grabbed, so the cheapest solution here would be to use a .net domain. Tho I don't know if it would make much sense. If your mirror is frequently used / attracts other users, it would not be required for me to create another instance.

Also I'd like to add more features like showcasing Steam Achievements.

SophiaAtkinson commented 3 months ago

@danielbrendel Currently I have Redis working 99.9% I am not too good at multiple integrations, but for now, I have the frame of reference for anyone who wants to integrate another KV storage system.

Here are the basic config options

# Redis settings
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_PASS="xyz"
REDIS_DATABASE=15
REDIS_EXPIRATION=3600 #3600 seconds = 1 hour

I think for the time being this covers all of the bases. REDIS_PASS can also be left empty for those who need it to be empty.

If you have any other questions, feel free to ask! I'm on track to open a PR later this week.

-SRA