Store string data in the server's internal memory cache.

 

Syntax

function MemCachePut(const AKey, AData: string): int64;

 

Parameters and return values

Parameter

Type

Value

AKey

string

record key, a unique text string;

AData

string

data to store; a text string of any length, including an empty string.

 

Function result

Internal numeric identifier of the new/updated record. If the key is empty, the function will return -1.

 

Example

var
  iID: int64;
begin
  iID := MemCachePut('server_status', 'online');
  mLogScript('New cache record created or updated, ID=' + IntToStr(iID), 'MEMCACHE')
end.


Script work result

[20:56:10] (Log "MemCachePutExample"): [MEMCACHE] New cache record created or updated, ID=13

[20:56:10] (Run "MemCachePutExample"): Script operation time: 2 ms

[20:56:10] (Run "MemCachePutExample"): Script done successfully.

 

See also

IntToStr

mLogScript