I'm using NPM install API cache for my MERN application. I want one of my requests to be cached and then when a request is made to another route it refreshes the cache (it fetches the new data). I've managed to get one of my requests to be cached but I can't manage to clear it.
This is my code
const apicache = require("apicache")

let cache = apicache.middleware

app.get("/api/users/checkJWT",cache("2 minutes"), async (req,res) => {
  const token = req.headers.authorization?.split(" ")[1]

  const decoded = jwt.verify(token,SECRET_KEY)

  if(decoded != null && await User.findById(decoded.id) != null) {
    return res.status(200).json({valid: true, user: await User.findById(decoded.id)})
  }
  else {
    return res.status(400).json({valid: false})
  }
})

app.patch("/api/users/user",authenticateJWTUser, async (req, res) => {
  apicache.clear('/api/users/checkJWT')
  const user = await User.findOne({ name: req.body.username });
  if (req.body.name != null) {
    user.name = req.body.name;
  }
  if (req.body.email != null) {
    user.email = req.body.email;
  }
  if (req.body.password != null) {
    user.password = await bcrypt.hash(req.body.password, 10);
  }
  if (req.body.tasks != null) {
    user.tasks = req.body.tasks;
  }
  try {
    const updatedUser = await user.save();
    res.json(updatedUser);
  } catch (error) {
    res.status(400).json({ message: error.message });
  }
});

Link to my Git repo: https://github.com/JesseOgunlaja/Task-Tracker-MERN/tree/ae1b0027bfa40f90ab7a3d6208c05a9eb41a4478

How to clear cache for a route with the 'apicache' package
I was able to get this work using the apicache-plus package.
const apicache = require("apicache-plus");

router.get(
  "/api/users/getName/1",
  apicache.middleware("10 minutes"),
  async (req, res, next) => {
    req.apicacheGroup = "toClear";
    const someData = { someName: "Amy" };
    res.json(someData);
  }
);

router.get("/api/users/user/1/2", async (req, res, next) => {
  console.log("something");
  apicache.clear("toClear");

  const user = { name: "Jeff" };
  res.json(user);
});

