Memcached API¶
The Memcached API provides a set of operations for interacting with Memcached, a distributed memory caching system. It allows users to store, retrieve, and manage cached data.
Why Integrate Memcached with EasyTask?¶
Integrating Memcached with EasyTask enables you to automate cache management operations within your workflows. This integration allows you to:
- Automate Cache Lifecycle Management: Programmatically set, get, update, and delete cache entries with configurable TTL as part of your automated workflows.
- Streamline Multi-Key Operations: Perform batch operations like multi-get, multi-set, and multi-delete to efficiently manage large sets of cached data.
- Monitor Cache Health: Retrieve server statistics and manage connections automatically to keep your caching layer running smoothly.
Required Values in Vault¶
{
"is_credentials": {
"userid": "test",
"passwd": "test123"
},
"integrations": {
"secret": {
"host": "xxxxxxxx (String Type)",
"port": "xxxxxxxx (String Type)"
}
}
}
Example Usage¶
curl -X POST http://localhost:8008/run-integration \
-H "Content-Type: application/json" \
-d '{
"is_credentials": {
"userid": "test",
"passwd": "test123"
},
"integration": "memcached",
"uuid": "ae0e8ba9-423a-410e-bba5-e1933ff868c5",
"init": {
"vault_path_key": "memcached/secret"
},
"action": [
{
"get_stats": {}
}
]
}'
{
"integration": "memcached",
"uuid": "ae0e8ba9-423a-410e-bba5-e1933ff868c5",
"init": {
"vault_path_key": "memcache/server1"
},
"error": false,
"action": [
{
"get_stats": ["10.0.21.106:11211 (0)",
{
"pid": "1",
"uptime": "309794",
"time": "1704005487",
"version": "1.6.22",
"pointer_size": "64",
"rusage_user": "36.523994",
"rusage_system": "7.480027",
"curr_items": "0",
"total_items": "12",
"bytes": "0",
"curr_connections": "2",
"total_connections": "11",
"connection_structures": "3",
"cmd_get": "16",
"cmd_set": "12",
"get_hits": "14",
"get_misses": "2",
"evictions": "0",
"bytes_read": "1869",
"bytes_written": "1621",
"limit_maxbytes": "67108864",
"threads": "4"
}
]
}
]
}
Functions¶
get_stats¶
get_stats: This function retrieves statistics from the Memcached server.
flush_all¶
flush_all: This function flushes all items from the Memcached server.
add¶
add: This function adds a new key-value pair to Memcached.
set¶
set: This function sets a key-value pair in Memcached.
set_multi¶
set_multi: This function sets multiple key-value pairs in Memcached.
| Input Parameter | Type | Description | Mandatory |
|---|---|---|---|
| mapping | dict | Dictionary of key-value pairs to set | yes |
| time | int | Expiration time in seconds | yes |
| key_prefix | str | Prefix for all keys | yes |
| Output Parameter | Type | Description |
|---|---|---|
| response | list | List of keys that failed to be set |
replace¶
replace: This function replaces the value of an existing key in Memcached.
append¶
append: This function appends data to an existing key's value in Memcached.
prepend¶
prepend: This function prepends data to an existing key's value in Memcached.
incr¶
incr: This function increments the value of an existing key in Memcached.
decr¶
decr: This function decrements the value of an existing key in Memcached.
get¶
get: This function retrieves the value of a key from Memcached.
gets¶
gets: This function retrieves the value and cas id of a key from Memcached.
get_multi¶
get_multi: This function retrieves multiple values from Memcached.
touch¶
touch: This function updates the expiry time of a key in Memcached.
delete¶
delete: This function deletes a key from Memcached.
delete_multi¶
delete_multi: This function deletes multiple keys from Memcached.
disconnect_all¶
disconnect_all: This function disconnects from all Memcached servers.
Frequently Asked Questions¶
How do I configure Memcached credentials in EasyTask?¶
Use the EasyTask vault system to securely store your Memcached connection details. Navigate to the integration configuration page and add your server details under a vault key like memcached/server1. Include the host and port of your Memcached server.
Can I use Memcached with both EasyTask Cloud and On-Premises?¶
Yes, Memcached works seamlessly with both EasyTask Cloud and On-Premises deployments. The configuration process is identical — just ensure the Memcached server is reachable from the integration server.
How do I troubleshoot Memcached connection issues?¶
Check the integration server logs in EasyTask for detailed error messages. Verify your host and port in the vault, ensure the Memcached server is accessible from the integration server, and test connectivity using the built-in connection test feature. You can also use the get_stats function to verify server responsiveness.