Skip to content

Caching strategy #10

@joshwcomeau

Description

@joshwcomeau

Right now, I'm accessing episode info straight from the TV Maze API. This means if you have 50 shows, on page-load I make 50 requests to TV Maze.

This is clearly not ideal, and it will likely upset the TV Maze folks if Tello continues to see actual usage.

My idea is fairly straightforward. I should add a new Mongo collection of show info, with episodes. This would be global, not connected to a specific user.

When a show is added, I check to see if the show exists. If it doesn't, I fetch it from TV Maze, and store the results in my database.

I'll need a cron job to run every night at midnight, and delete the entire collection. So the first request for a given show fetches it from TV Maze, but subsequent requests that day use the Mongo "cache".

But yeah, this is a lot of work, so I'm hesitant to do it until I need to.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions