Caching
Caching is where we store data in the frontend to be reused. This enables us to reduce the number of API calls to the backend and reduce latency. Because the benefits are so clear, it can be tempting to cache everything. However, there are some things to consider.
Concurrency is a clear issue. The data could be outdated, leading to confusion and data corruption when sending the wrong information to the backend. There are also security concerns. If one user logs out and another user logs in on the same computer, there is a risk that the second user will be able to access the first user’s items. With this, there must be a couple of checks in place. The correct user needs to be logged in and the data needs to be timestamped so that if the cached data is accessed past a certain period, a GET
request is made to refresh the data.
Our application is fairly locked down. We cannot access anything unless we are logged in. The main process that we could cache in our application...