Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache the results from meetup.com #20

Open
zainab-ali opened this issue Nov 4, 2020 · 1 comment
Open

Cache the results from meetup.com #20

zainab-ali opened this issue Nov 4, 2020 · 1 comment
Labels
good first issue Good for newcomers

Comments

@zainab-ali
Copy link
Collaborator

zainab-ali commented Nov 4, 2020

The number of attendees is displayed on each meetup page. For example:

image

This number is obtained by the server through a request to meetup.com. The server makes a request to meetup.com each time it receives a request for an upcoming meetup. Hence, it makes a request each time someone visits a page under https://www.lsug.co.uk/meetups/....

The number of attendees of meetup doesn't change much. If many people visit the same page at once, we'll make many redundant requests to meetup.com for the same unchanging information.

It would be far better to cache the number of people. We can store it in memory in the server for one minute, and only request it if the stored value is older than one minute.

Potential Solution

A simple cache can probably be implemented with a cats-effect ref containing a Scala Map. This should be added to the lsug.Meetup class.

Tests

You should at least test that:

  • the value is re-requested after one minute
  • it isn't requested before one minute is up

You will need to mock meetup.com. This hasn't been done in the codebase yet, and you're free to experiment with mocking tools and patterns.

Prerequisites

It would be useful if you've dabbled a little in functional programming.

What you'll learn

  • The motivation behind caching.
  • The basics of cats-effect.
  • How to safely work with state in concurrent functional programming.
  • How to test with time and cats-effect
  • How to mock during testing

Getting started

Read our Contributor Guide to get set up.

@zainab-ali zainab-ali added the good first issue Good for newcomers label Nov 4, 2020
zainab-ali added a commit that referenced this issue Nov 4, 2020
@asjad02
Copy link

asjad02 commented Dec 12, 2020

picking this one

etandon-coatue added a commit to etandon/lsug-website that referenced this issue Mar 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants