HTTP interface for the query cache

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

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. Each result is a JSON object with the following attributes:

  • hash: the query result’s hash
  • query: the query string
  • bindVars: the query’s bind parameters. this attribute is only shown if tracking for bind variables was enabled at server start
  • size: the size of the query result and bind parameters, in bytes
  • results: number of documents/rows in the query result
  • started: the date and time when the query was stored in the cache
  • hits: number of times the result was served from the cache (can be 0 for queries that were only stored in the cache but were never accessed again afterwards)
  • runTime: the query’s run time
  • dataSources: an array of collections/Views the query was using
Path Parameters
  • The name of the database.

Query Parameters
    HTTP Headers
      Responses
      • Is returned when the list of results can be retrieved successfully.

      • The server will respond with HTTP 400 in case of a malformed request,

      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.

      Query Parameters
        HTTP Headers
          Responses
          • The server will respond with HTTP 200 when the cache was cleared successfully.

          • The server will respond with HTTP 400 in case of a malformed request.

          Get the AQL query results cache configuration

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

          Returns the global AQL query results cache configuration. The configuration is a JSON object with the following properties:

          • mode: the mode the AQL query results cache operates in. The mode is one of the following values: off, on, or demand.

          • maxResults: the maximum number of query results that will be stored per database-specific cache.

          • maxResultsSize: the maximum cumulated size of query results that will be stored per database-specific cache.

          • maxEntrySize: the maximum individual result size of queries that will be stored per database-specific cache.

          • includeSystem: whether or not results of queries that involve system collections will be stored in the query results 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.

          Query Parameters
            HTTP Headers
              Responses
              • Is returned if the properties can be retrieved successfully.

              • The server will respond with HTTP 400 in case of a malformed request,

              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.

              After the properties have been changed, the current set of properties will be returned in the HTTP response.

              Note: changing the properties may invalidate all results in the cache.

              The properties need to be passed in the properties attribute in the body of the HTTP request. properties needs to be a JSON object with the following properties:

              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.

              Query Parameters
                HTTP Headers
                  Request Body application/json object
                  • whether or not to store results of queries that involve system collections.

                  • the maximum individual size of query results that will be stored per database-specific cache.

                  • the maximum number of query results that will be stored per database-specific cache.

                  • the maximum cumulated size of query results that will be stored per database-specific cache.

                  • the mode the AQL query cache should operate in. Possible values are off, on, or demand.

                  Responses
                  • Is returned if the properties were changed successfully.

                  • The server will respond with HTTP 400 in case of a malformed request,