dotCMS / dotCMS/core

[TASK] Implement flush cache region endpoint

Open
#35,197 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

stale Team : Modernization
Dominant language
Java
Stars
970
Forks
486
Avg merge
3d 33m
Merged PRs (30d)
170

Description

Description

Implement DELETE /v1/caches/{regionName} in CacheResource.java for the Maintenance portlet Cache tab. Flushes a specific cache region across all providers, or flushes all caches when "all" is passed. Must include the permission reset and PushPublishing filter reload side effects that the existing Struts action performs.

Acceptance Criteria
  • API caller must be able to flush a specific cache region by name (e.g., velocityCache, Permission)
  • Flush must clear the region across ALL providers via CacheLocator.getCache(name).clearCache(), not just a single provider
  • API caller must be able to flush all caches by passing all as the region name
  • When flushing all caches, endpoint must call MaintenanceUtil.flushCache()
  • Endpoint must always call APILocator.getPermissionAPI().resetAllPermissionReferences() after flushing
  • When flushing "all" or "system" region, endpoint must reload PushPublishing filters via DotInitializer.class.cast(APILocator.getPublisherAPI()).init()
  • API caller must receive a message indicating what was flushed
  • Must require backend user with Maintenance portlet access
Priority

None

Additional Context
  • Existing DELETE /v1/caches/provider/{p}/flush/{group} is NOT suitable — it flushes in a single provider only and its URL contract is provider-specific
  • The Struts action logic is in ViewCMSMaintenanceAction._flush() (lines 273–280) and the caller at lines 171–186
  • The CacheLocator.getCache("all") throws NPE which triggers the flushAll path — replicate this behavior

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in CacheResource.java and compare the endpoint with ViewCMSMaintenanceAction._flush() and its caller at the referenced lines. Verify the specific-region, all-cache, permission-reset, PushPublishing reload, message, and Maintenance-portlet permission behaviors against the acceptance criteria; the endpoint is done when those cases work through DELETE /v1/caches/{regionName}.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.