MyChat Scripts: MemCacheExists, check if the specified key exists in the MyChat Server memory cache
Check if a record with the specified key exists in the server's internal memory cache.
Syntax
function MemCacheExists(const AKey: string): boolean;
Parameters and return values
|
Parameter |
Type |
Value |
|
AKey |
string |
record key, a unique text string. |
Function result
True if the record exists, false if the key is not found. Note that the key name is a case-sensitive text string with a non-zero length. The cache contents may be empty.
Example
begin
if MemCacheExists('job_12345') then
mLogScript('The result is ready', 'MEMCACHE')
else
mLogScript('The result is not ready yet', 'MEMCACHE');
end.
Script work result
[20:28:10] (Log "MemCacheExistsExample"): [MEMCACHE] The result is not ready yet
[20:28:10] (Run "MemCacheExistsExample"): Script operation time: 3 ms
[20:28:10] (Run "MemCacheExistsExample"): Script done successfully.