Loading Python...

## KVIndex Interactive Documentation

#### Initialize KVIndex

from liteindex import KVIndex, EvictionCfg kv_index = KVIndex(db_path="./test.liteindex", store_key=True, preserve_order=True, ram_cache_mb=32, eviction=EvictionCfg(EvictionCfg.EvictNone))

#### Set values

kv_index['key1'] = 'value1' kv_index.update({"key2": "value2", "key3": "value3"})

#### Get values

get_value1 = kv_index["key1"] get_value2 = kv_index.get("key1", "default_value") multiple_values = kv_index.getvalues(["key1", "key2"]) print(get_value1, get_value2, multiple_values)

#### Delete values

del kv_index["key1"] kv_index.delete(["key2", "key3"]) kv_index.clear()

#### Iterate through KVIndex

for key in kv_index: print(key) for key in kv_index.keys(reverse=True): print(key) for value in kv_index.values(reverse=True): print(value) for key, value in kv_index.items(reverse=True): print(key, value)

#### Other operations

len_index = len(kv_index) contains_key1 = "key1" in kv_index print("Length:", len_index) print("Contains 'key1':", contains_key1)