Skip to main content

/images/icons/xs_temp.svg Set Cache Value

redis.set {
  key = ""
  data = ""
  ttl = 0
}
ParameterPurposeExample
keyCache key identifier"user:123", "session:abc"
dataValue to store"data", {user: "john"}
ttlTime-to-live in seconds300, 3600
redis.set {
  key = "user:"|add:$user.id
  data = $user.profile
  ttl = 3600
}
  • Stores a value in cache
  • Optional TTL for expiration
  • Overwrites existing values

/images/icons/xs_temp.svg Get Cache Value

redis.get {
  key = ""
} as x1
ParameterPurposeExample
keyCache key to retrieve"user:123"
asAlias for retrieved valuex1, cached_data
redis.get {
  key = "user:"|add:$user.id
} as user_data
  • Retrieves stored value
  • Returns null if key doesn’t exist

/images/icons/xs_temp.svg Has Cache Value

redis.has {
  key = ""
} as x2
ParameterPurposeExample
keyCache key to check"session:abc"
asAlias for resultx2, exists
redis.has {
  key = "session:"|add:$session.id
} as session_exists
  • Checks if key exists in cache
  • Returns boolean

/images/icons/xs_temp.svg Delete Cache Value

redis.del {
  key = ""
}
ParameterPurposeExample
keyCache key to delete"user:123"
redis.del {
  key = "temp:"|add:$id
}
  • Removes key and value from cache
  • No effect if key doesn’t exist

/images/icons/xs_temp.svg Increment Cache Value

redis.incr {
  package_key = ""
  key = ""
  by = 1
} as x3
ParameterPurposeExample
package_keyOptional namespace"app1"
keyCache key to increment"counter:123"
byIncrement amount1, 5
asAlias for new valuex3, new_count
redis.incr {
  key = "visits:"|add:$page.id
  by = 1
} as visit_count
  • Increments numeric value
  • Creates key with value 0 if doesn’t exist

/images/icons/xs_temp.svg Decrement Cache Value

redis.decr {
  key = ""
  by = 1
} as x4
ParameterPurposeExample
keyCache key to decrement"stock:123"
byDecrement amount1, 5
asAlias for new valuex4, new_count
redis.decr {
  key = "stock:"|add:$product.id
  by = 1
} as remaining_stock
  • Decrements numeric value
  • Creates key with value 0 if doesn’t exist

/images/icons/xs_temp.svg Get Cache Keys

redis.keys {
  search = ""
} as keys1
ParameterPurposeExample
searchPattern to match keys"user", "session"
asAlias for matched keyskeys1, matching_keys
redis.keys {
  search = "user"
} as active_sessions
  • Returns array of matching keys

/images/icons/xs_temp.svg Add To End of List

redis.push {
  package_key = ""
  key = ""
  value = ""
} as x5
ParameterPurposeExample
package_keyOptional namespace"app1", "myservice"
keyList key"queue:tasks", "notifications"
valueValue to append"task1", {id: 123}
asAlias for new list lengthx5, list_length
redis.push {
  package_key = "notifications"
  key = "user:"|add:$user.id
  value = $new_message
} as queue_length
  • Adds value to end of list
  • Creates list if it doesn’t exist
  • Returns new length of list
  • Supports any data type for value

/images/icons/xs_temp.svg Add To Beginning of List

redis.unshift {
  key = ""
  value = ""
} as x6
ParameterPurposeExample
keyList key"queue:tasks", "recent_items"
valueValue to prepend"new_task", {priority: "high"}
asAlias for new list lengthx6, list_length
redis.unshift {
  key = "recent_views"
  value = $page.id
} as list_size
  • Adds value to beginning of list
  • Creates list if it doesn’t exist
  • Returns new length of list
  • Useful for “most recent” lists

/images/icons/xs_temp.svg Remove From End of List

redis.pop {
  key = ""
} as x7
ParameterPurposeExample
keyList key"queue:tasks", "stack:items"
asAlias for popped valuex7, last_item
redis.pop {
  key = "task_queue"
} as next_task
  • Removes and returns last element
  • Returns null if list is empty
  • Reduces list length by 1
  • Common for stack operations

/images/icons/xs_temp.svg Remove From Beginning of List

redis.shift {
  key = ""
} as x8
ParameterPurposeExample
keyList key"queue:tasks", "processing"
asAlias for shifted valuex8, first_item
redis.shift {
  key = "message_queue"
} as next_message
  • Removes and returns first element
  • Returns null if list is empty
  • Reduces list length by 1
  • Common for queue operations

/images/icons/xs_temp.svg Remove From List

redis.remove {
  key = ""
  value = ""
  count = 0
}
ParameterPurposeExample
keyList key"active_users", "blocked_ips"
valueValue to remove"user123", {id: 456}
countNumber of occurrences to remove0 (all), 1, -2
redis.remove {
  key = "active_sessions"
  value = $session.id
  count = 0
}
  • Removes matching values from list
  • Count=0 removes all occurrences
  • Count>0 removes from head to tail
  • Count<0 removes from tail to head

/images/icons/xs_temp.svg Get Length Of List

redis.count {
  key = ""
} as x9
ParameterPurposeExample
keyList key"queue:pending", "users:online"
asAlias for list lengthx9, count
redis.count {
  key = "waiting_users"
} as queue_size
  • Returns current length of list
  • Returns 0 if list doesn’t exist
  • Useful for queue management
  • Quick operation regardless of list size

/images/icons/xs_temp.svg Get Elements From List

redis.range {
  key = ""
  start = 0
  stop = -1
} as x10
ParameterPurposeExample
keyList key"recent:items", "leaderboard"
startStart index0, 5, -10
stopEnd index-1, 9, 20
asAlias for range valuesx10, items
redis.range {
  key = "recent_posts"
  start = 0
  stop = 9
} as recent_items
  • Returns range of list elements
  • -1 means last element
  • Supports negative indices
  • Inclusive of start and stop indices

/images/icons/xs_temp.svg Rate Limit

redis.ratelimit {
  key = "ip:"|add:$request.ip
  max = 100
  ttl = 3600
  error = "Rate limit exceeded. Try again later."
} as rate_status
  • Implements rate limiting
  • Tracks attempts within time window
  • Returns current limit status
  • Throws error when limit exceeded
I