key–value store, is a data storage paradigm designed for storing, retrieving, and managing associative key-value pair.
A key-value pair is a set of two linked data items: a key, which is a unique identifier for some item of data, and the value, which is either the data that is identified or a pointer to the location of that data.
key-value can be used by kScript.
Add/Edit/Delete
Go to "Storage" -- "key value", add, update or delete key value pairs.
List of Keys
To display list of keys, use below code.
<script engine="kscript">
var keys = k.keyValue.keys;
</script>
<div k-foreach="item keys">
<h2 k-content="item">Welcome!</h2>
<a k-href="/detail?key={item}">link </a>
</div>
Get Value
To get the key from QueryString and get value from keyvalue store, see below.
<script engine="kscript">
var key = k.request.key;
if (key)
{
var value = k.keyValue.get(key);
}
</script>
<div class="jumbotron">
<h2 k-content="key"></h2>
<p k-content="value">Welcome to Kooboo CMS</p>
</div>