Skip to content

Key-Value Storage Service

Summary

Store, retrieve, and manage configuration or associative data in a powerful Key-Value database

Use it to safely store your configuration variables, logs, and much more. Based on the Redis database, this service provides many of the powerful Redis commands.

Important: The number of keys you can use are limited and depends on your Murano Business tier. Use the info operation to see your current usage.

Operations

Name Tag Summary
keystore.clear() Keys Clear solution
keystore.delete() Keys Delete key
keystore.get() Keys Get a key value
keystore.list() Keys Get namespace keys
keystore.mdelete() Keys Delete keys
keystore.mget() Keys Get multiple keys
keystore.mset() Keys Set multiple values
keystore.set() Keys Set the value of a key
keystore.info() Settings Get namespace information
keystore.command() Other Execute a Redis command

Operations

clear

Description

Remove all keys from this solution namespace. Be careful. There is no going back!

Arguments

Name Type Description
match string A filter to only return keys containing the matching string. The match filter is case-sensitive.
cursor string A pagination cursor to use if there's too many keys to return in a single call.
count integer Suggested number of elements to return in a single call. The actual number of elements returned could be more or less than the suggested ammount. Default is 1000, which also the largest value allowed.

Responses

  • Returns nil for All solution keys successfully removed

  • Returns {object} when Error

    Error response {object}

    Name Type Description
    type string Error type
    error string Error message
    status integer Response code

Example

Keystore.clear()

delete

Description

Remove a key-value from the store. This operation free a quota count for your namespace.

Arguments

Name Type Description
key string Key id

Responses

  • Returns nil for Key successfully deleted

  • Returns {object} when Error

    Error response {object}

    Name Type Description
    type string Error type
    error string Error message
    status integer Response code

Example

local result = Keystore.delete({ key = "myKey" })

get

Description

Returns the value of the given key.

Arguments

Name Type Description
key string Key id

Responses

  • Returns {object} when Key value successfully retrieved

    The response object containing the key value. {object}

    Name Type Description
    value array, object, string, number, boolean, null Key content
  • Returns {object} when Error

    Error response {object}

    Name Type Description
    type string Error type
    error string Error message
    status integer Response code

Example

local result = Keystore.get({ key = "myKey" })
print(result.value)

list

Description

Returns namespace keys and a pagination cursor. If list call returns non 0 for the cursor it means there are more keys avaliable. Pass the cursor to a second call to list to get the next page.

Arguments

Name Type Description
match string A filter to only return keys containing the matching string. The match filter is case-sensitive.
cursor string A pagination cursor to use if there's too many keys to return in a single call.
count integer Suggested number of elements to return in a single call. The actual number of elements returned could be more or less than the suggested ammount. Default is 1000, which also the largest value allowed.

Responses

  • Returns {object} when Namespace active keys

    Solution namespace information {object}

    Name Type Description
    keys [ string ] Active namespace keys
    cursor string Pagination cursor
  • Returns {object} when Error

    Error response {object}

    Name Type Description
    type string Error type
    error string Error message
    status integer Response code

Example

local keys = {}
cursor = "0"
repeat
  -- Be aware of excessive memory usage if your keyspace is large.
  local res = Keystore.list({match = "*", cursor = cursor})
  for _, k in ipairs(res.keys) do
    table.insert(keys, k)
  end
  cursor = res.cursor
until(cursor == "0")
return keys

mdelete

Description

Remove multiple keys-value from the store and return the number of removed keys. This operation free quota count for your namespace.

Arguments

Name Type Description
keys [ string {1..200} ] {..100} List of Keys

Responses

  • Returns {object} for Multi-delete response

    Name Type Description
    removed integer Number of new keys removed to the namespace.
  • Returns {object} when Error

    Error response {object}

    Name Type Description
    type string Error type
    error string Error message
    status integer Response code

Example

local result = Keystore.mdelete({ keys = {"key1", "key0"} })
print(result.removed)

mget

Description

Returns the values of the given keys.

Arguments

Name Type Description
keys [ string {1..200} ] {..100} List of Keys

Responses

  • Returns {object} for The response object containing the key values.

    Name Type Description
    values [ array, object, string, number, boolean, null ] Keys values data
  • Returns {object} when Error

    Error response {object}

    Name Type Description
    type string Error type
    error string Error message
    status integer Response code

Example

result = Keystore.mget({ keys = {"key1", "key2"} })
print(result.values[1])

mset

Description

Set or update multiple keys. This operation will increase your usage count.

Arguments

Name Type Description
keys [ string {1..200} ] {..100} List of Keys
values [ string, number, boolean, null ] Values to set in related keys. This array length MUST match the key length.

Responses

  • Returns {object} for Multi-Set response

    Name Type Description
    added integer Number of new keys added to the namespace.
  • Returns nil for Namespace, Key count quota reached. Delete some un-used keys or contact Murano team for upgrading your plan. You can view your current namespace usage with the _list operation or on your Murano portal account._

  • Returns {object} when Error

    Error response {object}

    Name Type Description
    type string Error type
    error string Error message
    status integer Response code

Example

local result = Keystore.mset({ keys = {"key1", "key2"}, values = {"value1", "value2"} })
print(result.added)

set

Description

Set or update a key value. If the key does not exist, this operation will increase your usage count. The value size cannot exceed 100kb.

Arguments

Name Type Description
key string Key id
value string, number, boolean, null Key content

Responses

  • Returns nil for Key successfully set

  • Returns nil for Namespace, Key count quota reached. Delete some unused keys or contact Murano team for upgrading your plan. You can view your current namespace usage with the _info operation or on your Murano portal account._

  • Returns {object} when Error

    Error response {object}

    Name Type Description
    type string Error type
    error string Error message
    status integer Response code

Example

Keystore.set({ key = "myKey", value = "myValue" })

info

Description

Returns namespace information including usage and quota.

Responses

  • Returns {object} when Namespace information including usage and quota

    Solution namespace information {object}

    Name Type Description
    quota object Usage limitation applying to this service
    quota.keys integer Maximum number of keys allowed for this solution depending on your Murano plan. Contact Murano team for more information.
    usage object Namespace usage
    usage.keys integer Current number of keys being used by the solution namespace.
    usage.size integer Total data size of solution namespace in bytes.
  • Returns {object} when Error

    Error response {object}

    Name Type Description
    type string Error type
    error string Error message
    status integer Response code

Example

local result = Keystore.info()
print("I am using " .. result.usage.keys .. " out of my " .. result.quota.keys .. " keys")

Other

command

Description

This function offers some popular Redis commands to execute on the key. Please refer to http://redis.io/commands documentation page for the command information and parameters. Remember, some commands will increase your namespace usage and may hit your namespace quota. Not all Redis commands are supported. Please refer to the command parameter information below for the available functions.

Arguments

Name Type Description
key string Key id
command "get", "set", "setnx", "getset", "del", "type", "exists", "strlen", "append", "getrange", "setrange", "bitcount", "bitpos", "getbit", "setbit", "incr", "incrby", "decr", "decrby", "incrbyfloat", "setex", "psetex", "expire", "pexpireat", "pexpire", "expireat", "pttl", "ttl", "persist", "lpush", "lpushx", "lindex", "llen", "linsert", "lrange", "lrem", "lset", "ltrim", "lpop", "rpop", "rpush", "rpushx", "sadd", "srem", "scard", "smembers", "sismember", "srandmember", "spop", "sscan", "hset", "hsetnx", "hdel", "hexists", "hget", "hgetall", "hincrby", "hincrbyfloat", "hkeys", "hlen", "hmget", "hmset", "hstrlen", "hvals", "hscan", "zadd", "zcard", "zincrby", "zcount", "zlexcount", "zrange", "zrangebylex", "zrangebyscore", "zrank", "zrem", "zremrangebylex", "zremrangebyscore", "zremrangebyrank", "zrevrange", "zrevrangebylex", "zrevrangebyscore", "zrevrank", "zscore", "zscan", "geoadd", "geohash", "geopos", "geodist", "georadius", "georadiusbymember" This function offers some popular Redis commands to execute on the key. Please refer to http://redis.io/commands documentation page for the command information and parameters.
args [ string, number, boolean ] List of arguments for the specified command. Please refer to http://redis.io/commands documentation page for the command information and parameters.

Responses

  • Returns {object} when Command successfully executed

    The response object containing the key value. {object}

    Name Type Description
    value array, object, string, number, boolean, null Key content
  • Returns nil for Namespace, Key count quota reached. Delete some un-used keys or contact Murano team for upgrading your plan. You can view your current namespace usage with the _list operation or on your Murano portal account._

  • Returns {object} when Error

    Error response {object}

    Name Type Description
    type string Error type
    error string Error message
    status integer Response code

Example

-- Add a string to a list
result = Keystore.command({
  key = "myList",
  command = "lpush",
  args = {"oneItem"}
})
-- Retrieve the list content
result = Keystore.command({
  key = "myList",
  command = "lrange",
  args = {0, -1}
})