lukecarr / trophies

🏆 Self-hosted web application for tracking PlayStation trophies
Apache License 2.0
1 stars 0 forks source link

Cache in SQLite #7

Closed lukecarr closed 1 year ago

lukecarr commented 1 year ago

Trophies.gg employs caching to reduce the number of API requests made to RAWG for video game metadata (background images, metacritic scores, etc.)

Currently, go-cache is used as a simple in-memory storage solution, but this isn't persistent. While go-cache does offer a workaround solution for persistence, I think we should look to optionally support Redis (in place of go-cache) if a REDIS_URI environment variable is detected.

go-redis is the official and de facto Go client for interacting with a Redis server.

This feature should involve creating an interface for the cache (currently, the specific implementation of go-cache is used in env.Env). Then, we can swap out the underlying implementation of the cache interface depending on what environment variables are set.

lukecarr commented 1 year ago

Might be over complicating things here. Let's just use SQLite to cache background images and other metadata instead.

This would also remove the dependency of go-cache.