p4 key
Synopsis
Display, set, or delete a key/value pair.
Syntax
p4 [g-opts] key name
p4 [g-opts] key name value
p4 [g-opts] key [-d] name
p4 [g-opts] key [-i] name
p4 [g-opts] key [-m] [pair list]
Description
Keys allow you to store name-value pairs for use in scripts. These
user-managed keys are stored in a table named
db.nameval.
The command includes the following variants:
-
The variant p4 key
namereturns the value of keyname. -
The variant p4 key
namevaluesets the value of the keynametovalue, and ifnamedoes not already exist, it is created. -
The variant p4 key -d
namedeletes the specified key. -
The variant p4 key -i
nameincrements a numeric key. -
The variant p4 key [-m]
pair listdefines multiple set and delete operations to be performed. Each operation is defined by a value pair in the pair list. To set a key, use a name and value, to delete a key, use a-(hyphen) followed by the name. See Examples.This variant is useful in distributed environments where running individual commands is likely to introduce unwanted latency.
If a key does not exist, its value is returned as zero; key names are not stored until set to a nonzero value.
If the dm.keys.hide configurable is set to 2,
admin access is required.
Options
|
|
Delete key |
|
|
Increment key |
|
|
Perform multiple key value operations in one command. See Examples. |
|
|
See “Global Options”. |
Usage Notes
|
Can File Arguments Use Revision Specifier? |
Can File Arguments Use Revision Range? |
Minimal Access Level Required |
|---|---|---|
|
N/A |
N/A |
|
Examples
|
p4 key |
Set the value of
Requires |
|
p4 key |
Display the value of
Requires |
|
p4 key -m |
Set two keys. |
|
p4 key -m - |
Delete two keys. |
|
p4 key -m |
Set one key; delete one key. |