Helix Core is now P4 and Helix Swarm is now P4 Code Review. Product user interfaces will be updated soon. Learn more >>

Documentation | 2025.5

# Cache: P4 Code Review Cache

From P4 Code Review 2022.2, P4 Code Review no longer supports APIs older than v9.

## P4 Code Review config cache file delete

Alternatively, use the Cache Info tab of the System Information page. Navigate to the User id dropdown menu, select System Information, and click the Cache Info tab. For more information, see Cache Info.

### Summary

Introduced for P4 Code Review 2019.2 and later, deletes the P4 Code Review configuration cache files and restarts the workers.

DELETE /api/v9/cache/config/

### Description

Used to delete the P4 Code Review configuration cache files after the P4 Code Review configuration or custom modules have changed. When workers complete their current tasks they are automatically restarted so that they use the new P4 Code Review configuration and custom modules for their next tasks.

Only admin users can delete the P4 Code Review configuration cache.

### Example response

#### When cache files are not deleted and workers are not shutdown:

For example, this can happen if you make the call and then make the same call again before the cache files have rebuilt.

    HTTP/1.1 200 OK

    {
        "isValid":true,
        "messages":[
            "File <SWARM_ROOT>/data/cache/module-config-cache.php was not deleted",
            "File <SWARM_ROOT>/data/cache/module-classmap-cache.php was not deleted"
        ]
    }

### Example of usage

It might also be possible to use a password in place of the ticket if your P4 Server allows it.

curl -u "username:ticket" -X DELETE "https://myswarm.url/api/v9/cache/config/"

Assuming that the authenticated user has permission, P4 Code Review responds with the cache deleted and workers shutdown messages:

    HTTP/1.1 200 OK

    {
        "isValid":true,
        "messages":[
            "File <SWARM_ROOT>/data/cache/module-config-cache.php deleted",
            "File <SWARM_ROOT>/data/cache/module-classmap-cache.php deleted",
            "Workers are shutdown. They will start automatically by recurring task"
        ]
    }

## Verify Redis cache

Alternatively, use the Cache Info tab of the System Information page. Navigate to the User id dropdown menu, select System Information, and click the Cache Info tab. For more information, see Cache Info.

### Summary

Introduced for P4 Code Review 2019.2 and later, verifies the P4 Code Review Redis cache.

POST /serverid/api/v9/cache/redis/verify?context=user,group,project,workflow

### Description

The data in the Redis cache for groups, users, projects, and workflows should be the same as the data held by the P4 Server. However, in some circumstances, such as when changes are made in the P4 Server when P4 Code Review is down or if errors occur during updates, the Redis cache can get out of sync with the P4 Server.

Used to verify the content of the Redis cache. Use the context parameter to verify specific areas of the Redis cache, if no context is specified the entire Redis cache is verified. If a verification finds an out of sync cache file, P4 Code Review automatically updates the data in that cache.

Only admin users can verify the Redis cache.

### Parameters

Parameter | Description | Type | Parameter Type | Required | Default Value
--- | --- | --- | --- | --- | ---
serverid | If P4 Code Review is connected to multiple P4 Servers, serverid specifies which P4 Server the cache should be verified for. | string | path | See description |
context | Add context to the call to verify a specific area of the Redis cache: No context specified, verifies all of the Redis caches. user verifies the Redis user cache. group verifies the Redis group cache. project verifies the Redis project cache. workflow verifies the Redis workflow cache. To verify multiple areas of cache, separate the entries with a comma , | string | path | No |

### Example usage

It might also be possible to use a password in place of the ticket if your P4 Server allows it.

To start verification of the user and group caches:

curl -u "username:ticket" -X POST "https://myswarm.url/api/v9/cache/redis/verify?context=user,group"

JSON response

    HTTP/1.1 200 OK

    {
        isValid: true,
        data: {
            user: {
                state: "Queued",
                progress: false
            },
            group: {
                state: "Queued",
                progress: false
            }
        },
        messages: {
            "Verifying Redis cache for [user,group]"
        }
    }

## Check progress of Redis cache verification

Alternatively, use the Cache Info tab of the System Information page. Navigate to the User id dropdown menu, select System Information, and click the Cache Info tab. For more information, see Cache Info.

### Summary

Introduced for P4 Code Review 2019.2 and later, check progress of the P4 Code Review Redis cache verification.

GET /serverid/api/v9/cache/redis/verify?context=user,group,project,workflow

### Description

Used to check the progress of Redis cache verification process. Use the context parameter to check verification of specific areas of the Redis cache, if no context is specified progress is checked for all areas of the entire Redis cache.

### Parameters

Parameter | Description | Type | Parameter Type | Required | Default Value
--- | --- | --- | --- | --- | ---
serverid | If P4 Code Review is connected to multiple P4 Servers, serverid specifies which P4 Server cache verification is being checked for. | string | path | See description |
context | Add context to the check verification progress for a specific area of the Redis cache: No context specified, checks verification progress for all of the Redis caches. user checks verification progress for the Redis user cache. group checks verification progress for the Redis group cache. project checks verification progress for the Redis project cache. workflow checks verification progress for the Redis workflow cache. To check the verification progress for multiple areas of cache, separate the entries with a comma , | string | path | No |

### Example usage

It might also be possible to use a password in place of the ticket if your P4 Server allows it.

To check verification progress for the user and group caches:

curl -u "username:ticket" "http://myswarm.url/api/v9/cache/redis/verify?context=user,group"

JSON response

    HTTP/1.1 200 OK

    {
        isValid: true,
        data: {
            user: {
                state: "Running",
                progress: "Step 2 of 5; Calculating checksums for Redis keys"
            },
            group: {
                state: "Running",
                progress: "Step 1 of 5; Getting Redis cache entries"
            }
        }
    }

- Valid states for verify are; Not Queued, Queued, Running, and Failed.
- Valid states for progress are, Step x of y; (where x is the current step and y is the total number of steps) followed by:

- Getting Redis cache entries
- Calculating checksums for Redis keys
- Calculating checksums for Perforce models
- Clearing any extraneous Redis cache entries
- Indexing any missing Perforce models into the Redis cache
- Verification complete

## Redis cache delete

### Summary

Introduced for P4 Code Review 2019.2 and later, deletes the P4 Code Review Redis cache.

DELETE /serverid/api/v9/cache/redis?context=user,group,project,workflow

### Description

Used to delete the Redis cache. Use the context parameter to delete specific areas of the Redis cache, if no context is specified the entire Redis cache is deleted.

Only admin users can delete the Redis cache.

### Parameters

Parameter | Description | Type | Parameter Type | Required | Default Value
--- | --- | --- | --- | --- | ---
serverid | If P4 Code Review is connected to multiple P4 Servers, serverid specifies which P4 Server the cache should be deleted for. | string | path | See description |
context | Add context to the call to delete a specific area of the Redis cache: No context specified, deletes all of the Redis caches. user deletes the Redis user cache. group deletes the Redis group cache. project deletes the Redis project cache. workflow deletes the Redis workflow cache. To delete multiple areas of cache, separate the entries with a comma , | string | path | No |

### Example response

#### When an invalid Redis cache context is specified:

If an invalid context is specified in the call:

    HTTP/1.1 200 OK

    {
        "isValid":true,
        "messages":[
            "Invalid context [usr], must contain only [user, group, project, workflow]",
        ]
    }

### Example of usage

It might also be possible to use a password in place of the ticket if your P4 Server allows it.

curl -u "username:ticket" -X DELETE "https://myswarm.url/serverA/api/v9/cache/redis?context=user,group"

Assuming that the authenticated user has permission, P4 Code Review responds with the cache deleted message:

    HTTP/1.1 200 OK

    {
        "isValid":true,
        "messages":[
            "Deleted key(s) [Swarm^serverA:user-populated-status, Swarm^serverA:group-populated-status]",
        ]
    }

Your search for returned results