Local Storage

Store key-value pairs as strings in the chassis

Set Key-Value Pair

lebai:set_item(key, value)
  • Parameters
    • key Key name
    • value Value corresponding to the key
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "set_item", "params": [{"key": "", "value": ""}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {}, "id": 1 }

Get Key-Value Pair

value = lebai:get_item(key)
  • Parameters

    • key. Key name
  • Returns

    • Value corresponding to the key
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "get_item", "params": [{"key": ""}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {"value": ""}, "id": 1 }

Get All Key-Value Pairs with Specified Prefix

values = lebai:get_items(prefix)
  • Parameters

    • prefix Key name prefix
  • Returns

    • Array of key-value pairs
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "get_items", "params": [{"prefix": ""}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {"items": [{"key": "", "value": ""}]}, "id": 1 }