Capy-Bearer Documentation

memcache_set

lib call

Capy

function memcache_set(connection : u64, key : string, value : string, expires_in : u64 = 3600) bool

Description

memcache_set() stores value under key on the external Memcache server, not in Bearer's kv_* cache.

The runtime passes expires_in unchanged in the text protocol. It does not convert a duration to an absolute timestamp. Follow your server's expiration rules for long lifetimes.

It returns true only when the server returns STORED. It normalizes whitespace in keys to underscores before it sends the request.

This normalization is transparent. The keys "a b" and "a_b" address the same entry.

Parameters

connection : the connection handle

key : the entry key

value : the value text

expires_in : the Memcache protocol expiration value, passed unchanged to the server

Return Values

true when the server stores the entry

Example

Capy

var connection := memcache_connect()
if connection { print(memcache_set(connection, "doc-key", "value"), "\n") }