Capy-Bearer Documentation

memcache_command

host call

Capy

function memcache_command(connection : u64, command : string) string

Description

memcache_command() sends command to the server and reads the complete response.

It follows the text-protocol framing: it consumes each VALUE header with exactly the payload length that header declares, so a stored value that itself contains END does not end the read early. It continues over STAT lines and stops at the first terminal line. A response is read across as many receives as it takes.

A response is bounded at 4 MB. A response larger than that, a closed connection, or an expired receive timeout yields a short response, which the dedicated Memcache functions report as a miss.

Use a dedicated Memcache function when one is available.

For get and gets, each protocol key token starts at token 1. For gat and gats, the protocol key token is token 2. For storage and single-key commands, the protocol key token is token 1.

The function normalizes whitespace in these protocol key tokens to underscores. It does not normalize command names, expiration tokens, metadata tokens, or payload text.

Parameters

connection : the connection handle

command : the Memcache command text

Return Values

the complete server response

Example

Capy

var connection := memcache_connect()
if connection { print(memcache_command(connection, "version"), "\n") }