Set Cache Value
| Parameter | Purpose | Example |
|---|---|---|
| key | Cache key identifier | "user:123", "session:abc" |
| data | Value to store | "data", {user: "john"} |
| ttl | Time-to-live in seconds | 300, 3600 |
Example
Example
- Stores a value in cache
- Optional TTL for expiration
- Overwrites existing values
Get Cache Value
| Parameter | Purpose | Example |
|---|---|---|
| key | Cache key to retrieve | "user:123" |
| as | Alias for retrieved value | x1, cached_data |
Example
Example
- Retrieves stored value
- Returns null if key doesn’t exist
Has Cache Value
| Parameter | Purpose | Example |
|---|---|---|
| key | Cache key to check | "session:abc" |
| as | Alias for result | x2, exists |
Example
Example
- Checks if key exists in cache
- Returns boolean
Delete Cache Value
| Parameter | Purpose | Example |
|---|---|---|
| key | Cache key to delete | "user:123" |
Example
Example
- Removes key and value from cache
- No effect if key doesn’t exist
Increment Cache Value
| Parameter | Purpose | Example |
|---|---|---|
| package_key | Optional namespace | "app1" |
| key | Cache key to increment | "counter:123" |
| by | Increment amount | 1, 5 |
| as | Alias for new value | x3, new_count |
Example
Example
- Increments numeric value
- Creates key with value 0 if doesn’t exist
Decrement Cache Value
| Parameter | Purpose | Example |
|---|---|---|
| key | Cache key to decrement | "stock:123" |
| by | Decrement amount | 1, 5 |
| as | Alias for new value | x4, new_count |
Example
Example
- Decrements numeric value
- Creates key with value 0 if doesn’t exist
Get Cache Keys
| Parameter | Purpose | Example |
|---|---|---|
| search | Pattern to match keys | "user", "session" |
| as | Alias for matched keys | keys1, matching_keys |
Example
Example
- Returns array of matching keys
Add To End of List
| Parameter | Purpose | Example |
|---|---|---|
| package_key | Optional namespace | "app1", "myservice" |
| key | List key | "queue:tasks", "notifications" |
| value | Value to append | "task1", {id: 123} |
| as | Alias for new list length | x5, list_length |
Example
Example
- Adds value to end of list
- Creates list if it doesn’t exist
- Returns new length of list
- Supports any data type for value
Add To Beginning of List
| Parameter | Purpose | Example |
|---|---|---|
| key | List key | "queue:tasks", "recent_items" |
| value | Value to prepend | "new_task", {priority: "high"} |
| as | Alias for new list length | x6, list_length |
Example
Example
- Adds value to beginning of list
- Creates list if it doesn’t exist
- Returns new length of list
- Useful for “most recent” lists
Remove From End of List
| Parameter | Purpose | Example |
|---|---|---|
| key | List key | "queue:tasks", "stack:items" |
| as | Alias for popped value | x7, last_item |
Example
Example
- Removes and returns last element
- Returns null if list is empty
- Reduces list length by 1
- Common for stack operations
Remove From Beginning of List
| Parameter | Purpose | Example |
|---|---|---|
| key | List key | "queue:tasks", "processing" |
| as | Alias for shifted value | x8, first_item |
Example
Example
- Removes and returns first element
- Returns null if list is empty
- Reduces list length by 1
- Common for queue operations
Remove From List
| Parameter | Purpose | Example |
|---|---|---|
| key | List key | "active_users", "blocked_ips" |
| value | Value to remove | "user123", {id: 456} |
| count | Number of occurrences to remove | 0 (all), 1, -2 |
Example
Example
- Removes matching values from list
- Count=0 removes all occurrences
- Count>0 removes from head to tail
- Count<0 removes from tail to head
Get Length Of List
| Parameter | Purpose | Example |
|---|---|---|
| key | List key | "queue:pending", "users:online" |
| as | Alias for list length | x9, count |
Example
Example
- Returns current length of list
- Returns 0 if list doesn’t exist
- Useful for queue management
- Quick operation regardless of list size
Get Elements From List
| Parameter | Purpose | Example |
|---|---|---|
| key | List key | "recent:items", "leaderboard" |
| start | Start index | 0, 5, -10 |
| stop | End index | -1, 9, 20 |
| as | Alias for range values | x10, items |
Example
Example
- Returns range of list elements
- -1 means last element
- Supports negative indices
- Inclusive of start and stop indices
Rate Limit
Example
Example
- Implements rate limiting
- Tracks attempts within time window
- Returns current limit status
- Throws error when limit exceeded