Caching and threads
This section explores caching strategies, thread management, and the effective use of Java concurrency utilities. These are important concepts to embrace as we continue our journey of developing high-performance Java applications. We will explore these concepts, the associated best practices, and techniques to mitigate the risk of memory leaks introduced by their use.
Caching strategies
In programming, we use caching to temporarily store data in memory locations to permit rapid access. This allows us to repeatedly access the data without causing lag or system crashes. The benefits of caching include more responsible applications and less load on longer-term storage solutions, such as databases and database servers. Of course, there are pitfalls. If we do not properly manage our caches, we can introduce significant memory leaks into our applications.
There are multiple caching strategies for us to consider; two of them you should already be familiar with...