eBook – Guide Spring Cloud – NPI EA (cat=Spring Cloud)
announcement - icon

Let's get started with a Microservice Architecture with Spring Cloud:

>> Join Pro and download the eBook

eBook – Mockito – NPI EA (tag = Mockito)
announcement - icon

Mocking is an essential part of unit testing, and the Mockito library makes it easy to write clean and intuitive unit tests for your Java code.

Get started with mocking and improve your application tests using our Mockito guide:

Download the eBook

eBook – Java Concurrency – NPI EA (cat=Java Concurrency)
announcement - icon

Handling concurrency in an application can be a tricky process with many potential pitfalls. A solid grasp of the fundamentals will go a long way to help minimize these issues.

Get started with understanding multi-threaded applications with our Java Concurrency guide:

>> Download the eBook

eBook – Reactive – NPI EA (cat=Reactive)
announcement - icon

Spring 5 added support for reactive programming with the Spring WebFlux module, which has been improved upon ever since. Get started with the Reactor project basics and reactive programming in Spring Boot:

>> Join Pro and download the eBook

eBook – Java Streams – NPI EA (cat=Java Streams)
announcement - icon

Since its introduction in Java 8, the Stream API has become a staple of Java development. The basic operations like iterating, filtering, mapping sequences of elements are deceptively simple to use.

But these can also be overused and fall into some common pitfalls.

To get a better understanding on how Streams work and how to combine them with other language features, check out our guide to Java Streams:

>> Join Pro and download the eBook

eBook – Jackson – NPI EA (cat=Jackson)
announcement - icon

Do JSON right with Jackson

Download the E-book

eBook – HTTP Client – NPI EA (cat=Http Client-Side)
announcement - icon

Get the most out of the Apache HTTP Client

Download the E-book

eBook – Maven – NPI EA (cat = Maven)
announcement - icon

Get Started with Apache Maven:

Download the E-book

eBook – Persistence – NPI EA (cat=Persistence)
announcement - icon

Working on getting your persistence layer right with Spring?

Explore the eBook

eBook – RwS – NPI EA (cat=Spring MVC)
announcement - icon

Building a REST API with Spring?

Download the E-book

Course – LS – NPI EA (cat=Jackson)
announcement - icon

Get started with Spring and Spring Boot, through the Learn Spring course:

>> LEARN SPRING
Course – RWSB – NPI EA (cat=REST)
announcement - icon

Explore Spring Boot 3 and Spring 6 in-depth through building a full REST API with the framework:

>> The New “REST With Spring Boot”

Course – LSS – NPI EA (cat=Spring Security)
announcement - icon

Yes, Spring Security can be complex, from the more advanced functionality within the Core to the deep OAuth support in the framework.

I built the security material as two full courses - Core and OAuth, to get practical with these more complex scenarios. We explore when and how to use each feature and code through it on the backing project.

You can explore the course here:

>> Learn Spring Security

Course – LSD – NPI EA (tag=Spring Data JPA)
announcement - icon

Spring Data JPA is a great way to handle the complexity of JPA with the powerful simplicity of Spring Boot.

Get started with Spring Data JPA through the guided reference course:

>> CHECK OUT THE COURSE

Partner – Moderne – NPI EA (cat=Spring Boot)
announcement - icon

Refactor Java code safely — and automatically — with OpenRewrite.

Refactoring big codebases by hand is slow, risky, and easy to put off. That’s where OpenRewrite comes in. The open-source framework for large-scale, automated code transformations helps teams modernize safely and consistently.

Each month, the creators and maintainers of OpenRewrite at Moderne run live, hands-on training sessions — one for newcomers and one for experienced users. You’ll see how recipes work, how to apply them across projects, and how to modernize code with confidence.

Join the next session, bring your questions, and learn how to automate the kind of work that usually eats your sprint time.

Course – LJB – NPI EA (cat = Core Java)
announcement - icon

Code your way through and build up a solid, practical foundation of Java:

>> Learn Java Basics

1. Introduction

Visual Studio Code (VSCode) is a pioneer and still among the best-ranked editors when it comes to an integrated development environment (IDE) with excellent performance, multiple built-in features, and extensions. Its simple, intuitive, but expandable interface provides everything necessary and beyond to view and edit everything from basic text, through code, to PDF and image files.

To aid with the loading speed, overall performance, and convenience, Visual Studio Code implements caching and cache controls on several levels.

In this tutorial, we delve into file management and ways to manage different caches within the VSCode IDE. First, we go over the concept of a file cache in terms of loading and caching. After that, we explore how Visual Studio Code handles files and file changes. Next, we get into VSCode caches. Later, we see which caches are affected by common editor clearing and reloading operations. Finally, we set up a simple task to perform a cache-clearing operation during every VSCode launch.

For this tutorial, we work with Visual Studio Code version 1.103.2, assuming it’s installed normally, e.g., not a portable or custom-configuration deployment. This means the directory that holds the IDE data is at a known location that depends on the operating system (OS) in use:

  • Linux: ~/.config/Code/
  • macOS: ~/Library/Application Support/Code/
  • Windows: %APPDATA%\Code\

Notably, we refer to the above paths as simply DATA_DIRECTORY.

2. File Cache

Optimizing how data gets from its current source to where it’s needed can lead to great speed benefits.

2.1. Loading

In essence, loading means moving data from one memory storage, storage type, or sector to another. Usually, the main idea is to get data to a place where it can be managed (read from or written to) faster.

Commonly, loading occurs from a secondary memory medium such as a hard disk drive (HDD), solid state disk (SSD), or similar to main memory, e.g., volatile RAM. In fact, this is the main case we look at here as well. However, we can also load a resource over the network to main or secondary memory. What’s more, a load can occur between different parts of the same medium and even the filesystem.

Loading can be a slow task, especially in some cases:

  • source storage supports only low read rates
  • slow transfer speeds between the source and destination
  • source and destination reside on the same medium, reducing overall performance
  • big quantity of data

Big data often comes in the form of files. Hence, file caching is a common way for software to deal with bad performance during file manipulation.

2.2. Caching

In particular, caching is the process of ensuring recently fetched data is quickly available for further reads. Specifically, algorithms exist to decide on the definition of recency and how it affects data availability.

Often, caching can involve specialized memory. However, one way to cache is to leave already-fetched data in a separate part of the destination for further handling. Critically, clearing a cache essentially means to delete entries, whole files, or similar objects that hold cache information.

By design, caching creates copies of data, which can pose a challenge with data updates at the source that don’t get reflected at the destination.

3. VSCode File Handling

What happens with the data of a file and how VSCode caches it depends on the user actions.

3.1. New File

When creating a new file within VSCode, the data only lives in main memory. It doesn’t have a file handle linked with secondary memory.

This means that caching only happens internally within the hardware.

3.2. Open Existing File

When opening a file, VSCode loads chunks into main memory:

  • whole or part of the file
  • file indices, if any

After that, any edits on such existing files happen in-place.

This means a save operation directly writes to the file, while unsaved changes are treated the same as with a new file, i.e., they live in the volatile main memory.

3.3. Hot Exit

To reiterate, any unsaved changes remain in the RAM. Regardless of whether they are in a non-saved buffer or a changed file, changes can be lost when the editor process ends.

Because of this, VSCode introduces the Hot Exit mechanism that preserves any unsaved data to a specific location in non-volatile secondary memory when exiting:

<DATA_DIRECTORY>/Backups/

The directory above should hold unsaved files in case VSCode terminates. Deleting that store means losing all such changes.

3.4. File Watching

VSCode uses watchers like inotify (Linux), FSEvents (macOS), and ReadDirectoryChangesW (Windows).

These are a way to ensure any changes to files that are made outside VSCode get reflected within the editor. Notably, this mechanic isn’t always reliable.

4. VSCode Caches

To optimize performance and ensure smooth behavior, the Visual Studio Code editor uses different cache types.

4.1. File Indexing

VSCode provides different text and code facilities:

  • syntax highlighting
  • autocompletion
  • automatic data fetching
  • IntelliSense
  • code browsing
  • search

Many of them depend on file indexing. It enables quick operations without having to refresh many aspects of a given file inside the editor.

Of course, the indices themselves live on the filesystem:

<DATA_DIRECTORY>/User/workspaceStorage/<WORKSPACE_ID>

Critically, deleting a WORKSPACE_ID directory makes VSCode recreate it:

  • rebuild search and file indices from scratch
  • regenerate language server data
  • reset extension states (settings syncs, cached results, auth)

Although not really dangerous, caution is advised when considering the removal of workspaceStorage files due to the potential loss of saved credentials.

4.2. Performance Cache

Several directories contain cache data that only affects the performance of VSCode itself:

<DATA_DIRECTORY>/Cache/
<DATA_DIRECTORY>/CachedData/
<DATA_DIRECTORY>/Code Cache/

Let’s explain each one:

  • Cache: embedded Chromium (Electron) browser engine cache (mainly resources for the extension marketplace)
  • CachedData: transpiled or optimized JavaScript for VSCode and its extensions.
  • Code Cache: Chromium (V8) code cache

Again, these directories do not affect files directly and are rebuilt upon the editor restart.

5. Editor Reload and Clear Operations

Apart from simply restarting the editor, VSCode offers ways to reload certain parts of the interface or clear some caches. All operations are available via the Command Palette.

5.1. Reload Window

Essentially, the Reload Window operation in VSCode restarts the whole editor without actually exiting:

Visual Studio Code Reload Window

While this operation doesn’t reload specific caches, it does often lead to the proper display of file contents and user interface elements. Furthermore, it refreshes extensions.

5.2. Clear Search History

The Search: Clear Search History operation ensures any cached inputs in the search panels are cleared. Thus, it can resolve issues with search:

Visual Studio Code Clear Search History

However, in this case, file indexing also isn’t affected.

5.3. Clear Editor History

Similar to the last one, Clear Editor History is an operation that clears cached search terms. However, it works on the main search input control (top of the editor window):

Visual Studio Code Clear Editor History

So, this means no file history or search text is available for autocompletion or selection there.

5.4. Clear Recently Opened

Lastly, Clear Recently Opened removes the list of files, directories, and projects that VSCode stores as recently opened:

Visual Studio Code Clear Recently Opened

All of the operations in this section work with one specific database file:

<DATA_DIRECTORY>User/globalStorage/state.vscdb

Deleting the whole file may cause VSCode to reset certain interface layouts, but it’s recreated when required.

6. Cache Clear Task

For completeness, let’s assume we want to clear the editor history when starting VSCode and briefly explain how to do that.

First, we add a task to tasks.json in the .vscode project-level directory:

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "clearEditorHistory",
      "command": "${command:workbench.action.clearEditorHistory}"
    }
    [...]
  ]
}

After that, we use it in launch.json inside the same directory:

{
  "version": "0.2.0",
  "configurations": [
    {
      [...]
      "preLaunchTask": "clear-editor-history"
      [...]
    }
  ]
}

This way, clearEditorHistory becomes a preLaunchTask meaning that the clearing happens during initialization.

7. Summary

In this article, we explored caching in VSCode, how it works with files, ways to clear some caches inside the editor, and how different operations affect them.

In conclusion, knowing the different cache types in VSCode and how to manage them can be important for optimization or in case of issues.

Baeldung Pro – NPI EA (cat = Baeldung)
announcement - icon

Baeldung Pro comes with both absolutely No-Ads as well as finally with Dark Mode, for a clean learning experience:

>> Explore a clean Baeldung

Once the early-adopter seats are all used, the price will go up and stay at $33/year.

eBook – HTTP Client – NPI EA (cat=HTTP Client-Side)
announcement - icon

The Apache HTTP Client is a very robust library, suitable for both simple and advanced use cases when testing HTTP endpoints. Check out our guide covering basic request and response handling, as well as security, cookies, timeouts, and more:

>> Download the eBook

eBook – Java Concurrency – NPI EA (cat=Java Concurrency)
announcement - icon

Handling concurrency in an application can be a tricky process with many potential pitfalls. A solid grasp of the fundamentals will go a long way to help minimize these issues.

Get started with understanding multi-threaded applications with our Java Concurrency guide:

>> Download the eBook

eBook – Java Streams – NPI EA (cat=Java Streams)
announcement - icon

Since its introduction in Java 8, the Stream API has become a staple of Java development. The basic operations like iterating, filtering, mapping sequences of elements are deceptively simple to use.

But these can also be overused and fall into some common pitfalls.

To get a better understanding on how Streams work and how to combine them with other language features, check out our guide to Java Streams:

>> Join Pro and download the eBook

eBook – Persistence – NPI EA (cat=Persistence)
announcement - icon

Working on getting your persistence layer right with Spring?

Explore the eBook

Course – LS – NPI EA (cat=REST)

announcement - icon

Get started with Spring Boot and with core Spring, through the Learn Spring course:

>> CHECK OUT THE COURSE

Partner – Moderne – NPI EA (tag=Refactoring)
announcement - icon

Modern Java teams move fast — but codebases don’t always keep up. Frameworks change, dependencies drift, and tech debt builds until it starts to drag on delivery. OpenRewrite was built to fix that: an open-source refactoring engine that automates repetitive code changes while keeping developer intent intact.

The monthly training series, led by the creators and maintainers of OpenRewrite at Moderne, walks through real-world migrations and modernization patterns. Whether you’re new to recipes or ready to write your own, you’ll learn practical ways to refactor safely and at scale.

If you’ve ever wished refactoring felt as natural — and as fast — as writing code, this is a good place to start.

eBook Jackson – NPI EA – 3 (cat = Jackson)