cache

Usage: oredge cache ACTION [OPTIONS]

ACTION:
    purge
    list
    show
    delete

GLOBAL OPTIONS:
    --help
    --show-api                         print restful api request.
    --json                             print json format.
    --config                           specify config file, default is ~/.oredge/config.

Purge Cache

Usage: oredge cache purge [HTTP_APP_ID] [OPTIONS]

OPTIONS:
    --condition json                   condition, can add multiple times.
        variable object
            name string                variable name, uri,uri-arg,uri-seg,query-string,sorted-query-string,host,req-method,req-cookie,req-header,scheme,server-port,server-addr,first-x-forwarded-addr,last-x-forwarded-addr.
            args string|integer        args.
        operator object
            name string                operator name, eq,ne,lt,le,gt,ge,contains,contains-word,prefix,suffix,!contains,!contains-word,!prefix,!suffix.
        values array
            type string                str or rx or wc.
            value string               value.
        caseless bool                  is caseless, true or false.
    --url string                       url, can add multiple times.
    --prefix-uri string                prefix uri, can add multiple times.
    --prefix-uri-file string           the file that specify prefix uri.
    --http integer                     http application id.
    --note string                      note.

GLOBAL OPTIONS:
    --help
    --show-api                         print restful api request.
    --json                             print json format.
    --config                           specify config file, default is ~/.oredge/config.

--http HTTP_APP_ID

Specify to which HTTP application the cache is purged.

HTTP_APP_ID is the ID of the HTTP application.

You can specify it in two method

    oredge cache purge 1

or

    oredge cache purge --http 1

--note "description string"

You can add a description to this cache purge

--url "url string"

Specify which url you want to purge, for example: –url “http://test.com/a/b"

--prefix-uri

Specify which prefix uri you want to purge, for example: –prefix-uri “http://test.com/a/b"

--prefix-uri-file

You can put many prefix uri in a file, and specify the arguments.

--condition "json string"

If the type is conditional, this argument is required.

Example

we can use --http to specify HTTP or specify HTTP id directly.

Purge cache

Purge the cache of HTTP application id is 887 and the URL is http://test.label.com/a/b.

You can get HTTP application id from oredge app list command.

# oredge cache purge 887 --url "http://test.label.com/a/b"
ID: 887-84

Purge cache with conditional

Purge the cache of HTTP application id is 887 and the URL prefix is /a/b.

This example use –condition to specify which cache to be purge.

You can get HTTP application id from oredge app list command.

# oredge cache purge 887 --condition '{"variable":{"name":"uri"},"operator":{"name":"prefix"},"values":[{"type":"str","val":"/a/b"}],"caseless":false}'
ID: 887-85

Purge cache with multiple conditions

Purge the cache of HTTP application id is 887 and the URL prefix is /en/ or /cn/ and the HOST is openresty.org.

You can get HTTP application id from oredge app list command.

# oredge cache purge 887 \
    --condition '{"variable":{"name":"uri"},"operator":{"name":"prefix"},"values":[{"type":"str","val":"/en/"},{"type":"str","val":"/cn/"}]}' \
    --condition '{"variable":{"name":"host"},"operator":{"name":"eq"},"values":[{"type":"str","val":"openresty.org"}]}'
ID: 887-3

Purge cache with prefix uri

Purge the cache of HTTP application id is 887 and the URL prefix is /a/ or /b/

You can get HTTP application id from oredge app list command.

# oredge cache purge 887 --prefix-uri "http://test.com/a/" --prefix-uri "http://test.com/b/"
ID: 887-86

Purge cache with prefix uri file

Purge the cache of HTTP application id is 887 and the URL list is in prefix_uri.txt

You can get HTTP application id from oredge app list command.

# oredge cache purge 887 --prefix-uri-file prefix_uri.txt
ID: 887-86

List cache purge list

Usage: oredge cache list [http] [OPTIONS]

OPTIONS:
    --http integer                     HTTP application id.

GLOBAL OPTIONS:
    --help
    --show-api                         print restful api request.
    --json                             print json format.
    --config                           specify config file, default is ~/.oredge/config.

Example

List cache purge tasks of HTTP application 887 you have created.

You can get HTTP application id from oredge app list command.

# oredge cache list 887
ID        TYPE           DETAILS                      NOTE    CREATE TIME
887-85    conditional    URI:PREFIX:/a/b                      2021-07-15 04:25:53
887-84    urls           http://test.label.com/a/b            2021-07-15 04:25:03
887-83    urls           http://test.label.com/a/b            2021-07-15 04:22:49

Show a cache purge job’s detail

Usage: oredge cache show [id] [OPTIONS]

OPTIONS:
    --id integer                       purge cache id.

GLOBAL OPTIONS:
    --help
    --show-api                         print restful api request.
    --json                             print json format.
    --config                           specify config file, default is ~/.oredge/config.

Example

Show the detail of a cache purge 887-85.

You can get the cache purge id from oredge cache list HTTP_APP_ID command.

# oredge cache show 887-85
ID         : 887-85
TYPE       : conditional
DETAILS    : URI:PREFIX:/a/b
NOTE       :
CREATE TIME: 2021-07-15 04:25:53

Delete cache purge job

Usage: oredge cache delete [id] [OPTIONS]

OPTIONS:
    --id integer                       cache purge id.

GLOBAL OPTIONS:
    --help
    --show-api                         print restful api request.
    --json                             print json format.
    --config                           specify config file, default is ~/.oredge/config.

Example

Delete the cache purge record of 887-85.

You can get the cache purge id from oredge cache list HTTP_APP_ID command.

# oredge cache delete 887-85
OK