Index > Protocol
Protocol
ROMA protocol is compatible with memcached text-based protocol. Any memcached client libraries allows users to interact with ROMA.
Storage Command
set
Purpose
set is a command which stores data in ROMA.
Syntax
set <key> <flags> <exptime> <bytes> [noreply]\r\n
<datablock>\r\n
Semantics
| Name | Description | Required |
| <key> | Specify the key which a client asks to store the data. | Yes |
| <flags> | This values is not used. ROMA ignores this option. | Yes |
| <exptime> | Specify the expiration time(in unix time or seconds). If the value is 0 then the data will not be expired. If the value is not 0, then specify the unix time or the number of seconds from current time. The client can not search the expired data. | Yes |
| <bytes> | Specify the number of bytes of data block without the delimiting \r\n. If the value is 0 then it follows by an empty data block. | Yes |
| [noreply] | This values is not used. ROMA ignores this option. | No |
| <datablock> | Specify a chunk of arbitrary 8-bit data. This data of length is <bytes> from the previous line. | Yes |
Return Code
After sending the command line and the data block, the client awaits the reply as follows.
STORED\r\n
Otherwise NOT_STORED\r\n
add
Purpose
add is a command which stores data in ROMA, only if ROMA doesn't already hold the data for this key.
Syntax
add <key> <flags> <exptime> <bytes> [noreply]\r\n
<datablock>\r\n
Semantics
| Name | Description | Required |
| <key> | Specify the key which a client asks to store the data. | Yes |
| <flags> | This values is not used. ROMA ignores this option. | Yes |
| <exptime> | Specify the expiration time(in unix time or seconds). If the value is 0 then the data will not be expired. If the value is not 0, then specify the unix time or the number of seconds from current time. The client can not search the expired data. | Yes |
| <bytes> | Specify the number of bytes of data block without the delimiting \r\n. If the value is 0 then it follows by an empty data block. | Yes |
| [noreply] | This values is not used. ROMA ignores this option. | No |
| <datablock> | Specify a chunk of arbitrary 8-bit data. This data of length is <bytes> from the previous line. | Yes |
Return Code
After sending the command line and the data block, the client awaits the reply as follows.
STORED\r\n
Otherwise NOT_STORED\r\n
replace
Purpose
replace is a command which stores data in ROMA, only if ROMA does already hold the data for this key.
Syntax
replace <key> <flags> <exptime> <bytes> [noreply]\r\n
<datablock>\r\n
Semantics
| Name | Description | Required |
| <key> | Specify the key which a client asks to store the data. | Yes |
| <flags> | This values is not used. ROMA ignores this option. | Yes |
| <exptime> | Specify the expiration time(in unix time or seconds). If the value is 0 then the data will not be expired. If the value is not 0, then specify the unix time or the number of seconds from current time. The client can not search the expired data. | Yes |
| <bytes> | Specify the number of bytes of data block without the delimiting \r\n. If the value is 0 then it follows by an empty data block. | Yes |
| [noreply] | This values is not used. ROMA ignores this option. | No |
| <datablock> | Specify a chunk of arbitrary 8-bit data. This data of length is <bytes> from the previous line. | Yes |
Return Code
After sending the command line and the data block, the client awaits the reply as follows.
STORED\r\n
Otherwise NOT_STORED\r\n
append
Purpose
append is a command which adds this data to an existing key after existing data.
Syntax
append <key> <bytes> [noreply]\r\n
<datablock>\r\n
Semantics
| Name | Description | Required |
| <key> | Specify the key which a client asks to store the data. | Yes |
| <bytes> | Specify the number of bytes of data block without the delimiting \r\n. If the value is 0 then it follows by an empty data block. | Yes |
| [noreply] | This values is not used. ROMA ignores this option. | No |
| <datablock> | Specify a chunk of arbitrary 8-bit data. This data of length is <bytes> from the previous line. | Yes |
Return Code
After sending the command line and the data block, the client awaits the reply as follows.
STORED\r\n
Otherwise NOT_STORED\r\n
prepend
Purpose
prepend is a command which adds this data to an existing key before existing data.
Syntax
prepend <key> <bytes> [noreply]\r\n
<datablock>\r\n
Semantics
| Name | Description | Required |
| <key> | Specify the key which a client asks to store the data. | Yes |
| <bytes> | Specify the number of bytes of data block without the delimiting \r\n. If the value is 0 then it follows by an empty data block. | Yes |
| [noreply] | This values is not used. ROMA ignores this option. | No |
| <datablock> | Specify a chunk of arbitrary 8-bit data. This data of length is <bytes> from the previous line. | Yes |
Return Code
After sending the command line and the data block, the client awaits the reply as follows.
STORED\r\n
Otherwise NOT_STORED\r\n
cas
Purpose
cas is a check and set command. ROMA stores this data only if no one else has updated since ROMA last fetched it.
Syntax
cas <key> <flags> <exptime> <bytes> <cas unqiue> [noreply]\r\n
<datablock>\r\n
Semantics
| Name | Description | Required |
| <key> | Specify the key which a client asks to store the data. | Yes |
| <flags> | This values is not used. ROMA ignores this option. | Yes |
| <exptime> | Specify the expiration time(in unix time or seconds). If the value is 0 then the data will not be expired. If the value is not 0, then specify the unix time or the number of seconds from current time. The client can not search the expired data. | Yes |
| <bytes> | Specify the number of bytes of data block without the delimiting \r\n. If the value is 0 then it follows by an empty data block. | Yes |
| <cas unique> | Specify a unique 64-bit value of an existing entry. If you use cas command, the client should to get this value by gets command. | Yes |
| [noreply] | This values is not used. ROMA ignores this option. | No |
| <datablock> | Specify a chunk of arbitrary 8-bit data. This data of length is <bytes> from the previous line. | Yes |
Return Code
After sending the command line and the data block, the client awaits the reply as follows.
STORED\r\n
The item you are trying to store with a cas command has been modified since you last fetched it. EXISTS\r\n
Otherwise NOT_STORED\r\n
Retrieval Command
get, gets
Purpose
get and gets are retrieval commands.
Syntax
get <key>\r\n
gets <key>\r\n
Semantics
| Name | Description | Required |
| <key> | Specify one or more key strings separated by whitespace. | Yes |
Return Code
- Each item is sent by the server.
VALUE <key> <flags> <bytes> [<cas unique>]\r\n
<data block>\r\n
- <key> is the key which is specified the previous command.
- <flags> This values is not used.
- <bytes> is the number of bytes of data block without the delimiting \r\n.
- [<cas unique>] is a unique 64-bit integer. Only if you uses gets command.
- <data block> is the data.
- Finally, the server sends the strings.
END\r\n
Deletion Command
delete
Purpose
delete is a command which deletes the data logically.
Syntax
delete <key> [<time>] [noreply]\r\n
Semantics
| Name | Description | Required |
| <key> | Specify the key which you want to delete in ROMA. | Yes |
| [<time>] | This values is not used. ROMA ignores this option. | No |
| [noreply] | This values is not used. ROMA ignores this option. | No |
Return Code
After sending the command line, the client awaits the reply as follows.
DELETED\r\n
Otherwise NOT_FOUND\r\n
Increment/Decrement
incr, decr
Purpose
incr and decr are commands which increase/decrease the value to existing data.
Syntax
incr <key> <value> [noreply]\r\n
decr <key> <value> [noreply]\r\n
Semantics
| Name | Description | Required |
| <key> | Specify the key which you want to increase/decrease the item. | Yes |
| <value> | Specify the number of a 64-bit unsigned integer. this value is which you want to increase/decrease to the item. | Yes |
| [noreply] | This values is not used. ROMA ignores this option. | Yes |
Return Code
After sending the command line, the client awaits the reply as follows.
<value>\r\n
When the key is not found. NOT_FOUND\r\n
Other Command
balse
Purpose
balse is a command which ROMA will be shutdown.
Syntax
balse [<reason>]\r\n
- The server will confirm, you should answer.
Are you sure?(yes/no)\r\n
- yes ROMA will be shutdown immediately.
- no ROMA doesn't do nothing and this connection will close.
Semantics
| Name | Description | Required |
| [reason] | Sepecify one word which is written to log files. | No |
Return Code
stats, (stat)
Purpose
stats is a command which ROMA informs ROMA's own status.
Syntax
stats\r\n
If you want to show a part of stats, you should use <args> in the regular expression.
stats <args>\r\n
Return Code
Refer to Stats_Information for more detail information about stats command.