OScript API/Built-in Package Index |
The Memcached package provides the client interface API to a Memcached server. The major functionalities offered in the Memcached Package are the following:
Data was not stored.
Generic error constant.
Error initializing Memcached.
Specified key already exists in cache.
Specified key was not found in the cache.
Out of memory error constant.
Memcached not initialized. Call Init() to initialize Memcached.
The specified server could not be found in the server list.
Return code for a successful operation.
Add a key/value pair to the cache
Add a server to the client server list.
Decrement the value corresponding to key by num.
Delete the key entry in the cache.
Retrieve the value corresponding to key.
Increment the value corresponding to key.
Initialize the Memcached client.
Retrieve multiple values corresponding to the keys in keyList.
Replace the value corresponding to key with newValue.
Set a key/value pair to the cache
Return a set of statistics for the specified server.
Return the version number for the specified server.
The data could not be stored in Memcached.
Generic error constant.
Server failed to initialize.
Key already exists in cache.
Key not found.
Not enough memory.
Memcached not initialized. Call Init() to intialize before calling any other features.
Server not found.
Return code for an successful operation.
Add a key/value pair to the cache.
String containing the key to be added to the cache.
String containing the value to be added to the cache.
Length of value to be added.
Time, in seconds, for the data to live on the server. Enter 0 for indefinite timeout.
Any flags set by the client for this key.
A return code indicating the operation status. Possible values are:
Result | Meaning |
---|---|
SUCCESS | Operation was successful |
KEYALREADYEXIST | key already exists in the cache |
SERVERNOTFOUND_ERROR | No servers were found. |
NOTINITIALIZED | Memcached not initialized. Call Init() before calling any other features. |
DATA_ERROR | value could not be stored in Memcached. |
ERROR | any other errors |
Add a server to the Memcached client server list.
hostname of the server.
port of the server.
minimum number of client sockets to open.
soft maximum number of client connections to open.
hard maximum number of client connections to open.
time to live, in seconds, of a client connection.
A return code indicating the operation status. Possible values are:
Result | Meaning |
---|---|
SUCCESS | Operation was successful |
NOMEMORY | Not enough memory to add server. |
NOTINITIALIZED | Memcached not initialized. Call Init() before calling any other features. |
ERROR | any other errors |
Decrement the value corresponding to key by num.
key to the value being decremented.
number to decrement by.
A return code indicating the operation status. Possible values are:
Result | Meaning |
---|---|
SUCCESS | Operation was successful |
SERVERNOTFOUND_ERROR | No servers were found. |
NOTINITIALIZED | Memcached not initialized. Call Init() before calling any other features. |
ERROR | any other errors |
Delete key from the cache.
The key to delete.
time for the delete to stop other clients from adding.
An Integer indicating the return status. Possible values are:
Result | Meaning |
---|---|
SUCCESS | Operation was successful |
SERVERNOTFOUND_ERROR | No servers were found |
KEYNOTFOUND | The key was not found in the cache. |
NOTINITIALIZED | Memcached not initialized. Call Init() before calling any other features. |
ERROR | any other errors |
Get the value corresponding to key from the cache.
The key to get.
A string containing the retrieved value if successful else an error code. Possible error codes are:
Result | Meaning |
---|---|
KEYNOTFOUND | The key was not found in the cache. |
NOTINITIALIZED | Memcached not initialized. Call Init() before calling any other features. |
ERROR | any other errors |
Increment the value corresponding to key by num.
key to the value being incremented.
number to increment by.
A return code indicating the operation status. Possible values are:
Result | Meaning |
---|---|
SUCCESS | Operation was successful |
SERVERNOTFOUND_ERROR | No servers were found. |
NOTINITIALIZED | Memcached not initialized. Call Init() before calling any other features. |
ERROR | any other errors |
Initialize the Memcached client with a maximum of maxServers servers.
Maximum number of servers that can be added to this client.
A return code indicating the operation status. Possible values are:
Result | Meaning |
---|---|
SUCCESS | Operation was successful |
INIT_ERROR | Server failed to initialize. |
Get a list of values, corresponding to the list of keys in keyList, from the cache.
A list keys to get from the cache.
An Assoc containing the retrieved key/value pairs if successful else an error code. Possible error codes are:
Result | Meaning |
---|---|
NOTINITIALIZED | Memcached not initialized. Call Init() before calling any other features. |
ERROR | any other errors |
Add a key/value pair to the cache.
String containing the key to be replaced in the cache.
String containing the new value to replace the current value corresponding to key in the cache.
Length of the newValue.
Time, in seconds, for the data to live on the server. Enter 0 for indefinite timeout.
Any flags set by the client for this key.
A return code indicating the operation status. Possible values are:
Result | Meaning |
---|---|
SUCCESS | Operation was successful |
KEYNOTFOUND | key not found in the cache |
SERVERNOTFOUND_ERROR | No servers were found. |
NOTINITIALIZED | Memcached not initialized. Call Init() before calling any other features. |
DATA_ERROR | newValue could not be stored in Memcached. |
ERROR | any other errors |
Set a key/value pair to the cache.
String containing the key to be added to the cache.
String containing the value to be added to the cache.
Length of value to be added.
Time, in seconds, for the data to live on the server. Enter 0 for indefinite timeout.
Any flags set by the client for this key.
A return code indicating the operation status. Possible values are:
Result | Meaning |
---|---|
SUCCESS | Operation was successful |
SERVERNOTFOUND_ERROR | No servers were found. |
NOTINITIALIZED | Memcached not initialized. Call Init() before calling any other features. |
DATA_ERROR | value could not be stored in Memcached. |
ERROR | any other errors |
Retrieves statistics for the specified server.
hostname of the server.
port of the server.
Returns an Assoc containing various statistics for the specified server. The Assoc contains the following keys:
version | Version string of this server |
pid | Process id of this server process |
uptime | Number of seconds this server has been running |
time | current UNIX time according to the server |
pointer_size | The size of a pointer on the current machine |
rusage_user | Accumulated user time for this process |
rusage_system | Accumulated system time for this process |
curr_items | Current number of items stored by the server |
total_items | Total number of items stored by this server |
bytes | Current number of bytes used by this server to store items |
curr_connections | Number of open connections |
total_connections | Total number of connections opened since the server started running |
connection_structures | Number of connection structures allocated by the server |
cmd_get | Cumulative number of retrieval requests |
cmd_set | Cumulative number of storage requests |
get_hits | Number of keys that have been requested and found present |
get_misses | Number of items that have been requested and not found |
evictions | Number of items removed from cache because they passed their expiration time |
bytes_read | Total number of bytes read by this server |
bytes_written | Total number of bytes sent by this server |
limit_maxbytes | Number of bytes this server is allowed to use for storage |
threads | Number of threads the server is running (if built with threading) |
If unsuccessful the following error codes may be returned:
Result | Meaning |
---|---|
SERVERNOTFOUND_ERROR | No servers were found. |
NOTINITIALIZED | Memcached not initialized. Call Init() before calling any other features. |
ERROR | any other errors |
Retrieves the version number for the specified server.
hostname of the server.
port of the server.
Returns a string containing the version number for the specified server if successful else returns an error code. Possible error codes are:
Result | Meaning |
---|---|
SERVERNOTFOUND_ERROR | No servers were found. |
NOTINITIALIZED | Memcached not initialized. Call Init() before calling any other features. |
ERROR | any other errors |
Copyright © 2021 OpenText Corporation. All rights reserved. |