You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The number of attendees is displayed on each meetup page. For example:
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.
The number of attendees is displayed on each meetup page. For example:
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:
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
Getting started
Read our Contributor Guide to get set up.
The text was updated successfully, but these errors were encountered: