Animechan-API / animechan

A REST API for anime quotes
https://animechan.io
Mozilla Public License 2.0
1.31k stars 56 forks source link

feat(api): implement caching for random quote retrieval #112

Closed rocktimsaikia closed 3 months ago

rocktimsaikia commented 3 months ago

This PR introduces optimization on the /random endpoint. closes #111

It optimizes database queries by caching the total count of records for different variations of the query. Instead of querying the database multiple times to get the total count, the cache is used to quickly retrieve the count, reducing unnecessary database roundtrips.