HTTP interface for the query results cache

The query results cache HTTP API lets you control the cache for AQL query results

See The AQL query results cache for a description of the feature and the configuration options.

The AQL query results cache is only available for single servers, i.e. servers that are not part of a cluster setup.

List the entries of the AQL query results cache

GET /_db/{database-name}/_api/query-cache/entries
Returns an array containing the AQL query results currently stored in the query results cache of the selected database.
Path Parameters
  • The name of the database.

Responses
  • The list of cached query results.

      Response Body application/json
    • The entries of the query results cache.

      • The bind parameters. This attribute is omitted if the --query.tracking-with-bindvars startup option is set to false.

      • The collections and Views involved in the query.

      • The hash value calculated from the the query string, certain query options, and the bind variables.

      • How many times the result has been served from the cache so far.

      • The query string.

      • The number of documents/rows in the query result.

      • The total duration of the query in seconds.

      • The size of the query result and bind parameters (in bytes).

      • The date and time at which the query result has been added to the cache (in ISO 8601 format).

  • The request is malformed.

Retrieve the entries stored in the AQL query results cache of the current database:

curl --header 'accept: application/json' --dump - 'http://localhost:8529/_api/query-cache/entries'
Show output

Clear the AQL query results cache

DELETE /_db/{database-name}/_api/query-cache
Clears all results stored in the AQL query results cache for the current database.
Path Parameters
  • The name of the database.

Responses
  • The results cache has been cleared.

      Response Body application/json object
    • The HTTP response status code.

    • A flag indicating that no error occurred.

  • The request is malformed.

Clear the AQL query results cache of the current database:

curl -X DELETE --header 'accept: application/json' --dump - 'http://localhost:8529/_api/query-cache'
Show output

Get the AQL query results cache configuration

GET /_db/{database-name}/_api/query-cache/properties
Returns the global AQL query results cache configuration.
Path Parameters
  • The name of a database. Which database you use doesn’t matter as long as the user account you authenticate with has at least read access to this database.

Responses
  • The result cache configuration is returned successfully.

      Response Body application/json object
      The result cache configuration.
    • Whether results of queries that involve system collections are stored in the query results cache.

    • The maximum individual result size of queries that are stored per database-specific cache (in bytes).

    • The maximum number of query results that are stored per database-specific cache.

    • The maximum cumulated size of query results that are stored per database-specific cache (in bytes).

    • The mode the AQL query results cache operates in.

      Possible values: "off", "on", "demand"

  • The request is malformed.

Retrieve the global configuration of the AQL query results cache:

curl --header 'accept: application/json' --dump - 'http://localhost:8529/_api/query-cache/properties'
Show output

Set the AQL query results cache configuration

PUT /_db/{database-name}/_api/query-cache/properties

Adjusts the global properties for the AQL query results cache.

Changing the properties may invalidate all results currently in the cache.

Path Parameters
  • The name of a database. Which database you use doesn’t matter as long as the user account you authenticate with has at least read access to this database.

Request Body application/json object
    The result cache configuration settings to change.
  • Whether to store results of queries that involve system collections in the cache.

  • The maximum individual size of query results that are stored per database-specific cache (in bytes).

  • The maximum number of query results that are stored per database-specific cache.

  • The maximum cumulated size of query results that are stored per database-specific cache (in bytes).

  • The mode the AQL query cache shall operate in.

    Possible values: "off", "on", "demand"

Responses
  • The result cache configuration has been changed successfully.

      Response Body application/json object
      The result cache configuration.
    • Whether results of queries that involve system collections are stored in the query results cache.

    • The maximum individual result size of queries that are stored per database-specific cache (in bytes).

    • The maximum number of query results that are stored per database-specific cache.

    • The maximum cumulated size of query results that are stored per database-specific cache (in bytes).

    • The mode the AQL query results cache operates in.

      Possible values: "off", "on", "demand"

  • The request is malformed.

Change some properties of the global configuration of the AQL query results cache:

curl -X PUT --header 'accept: application/json' --data-binary @- --dump - 'http://localhost:8529/_api/query-cache/properties' <<'EOF'
{
  "mode": "demand",
  "maxResults": 32
}
EOF
Show output