North-Seattle-College / ad440-winter2021-thursday-repo

NSC AD 440 Winter 2021 Thursday cohort practicum repo
Apache License 2.0
2 stars 27 forks source link

Pagination for Users + Users/UserID/Tasks Environ fix #244

Closed kieranmiguel closed 3 years ago

kieranmiguel commented 3 years ago

Allows for pagination variables to adjust the count and page of users that is selected. Format: /users/?count={count}&page={page}

When a request is made, the API "Divides" up the tasks based on the count of users that is selected. For example, is one queries for 10 count and page 5, and there are 50 tasks, tasks 40-50 will appear. If one queries for count 4 and page 5, tasks 16-20 will appear.

Redis Caching works by setting an individual key for each pagination and count variable. So even queries that contain some of the same tasks will not pull from the same redis key. Redis caches are set to expire after a time of 1200 seconds. This means caching currently only supports identical requests.

Testing: To test, send a postman get request in this format: /users/?count=4&page=5 and make sure CACHE-TOGGLE = "On" in local.settings.json

The first request should query the cache and then return from the database, a second subsequent request should query the cache. This information should be available in the terminal