Skip to content

Delete Data

Delete key/value pairs

Delete a entry (a value) assigned to a key named "name"

.key("name").delete()

Delete an entry (a value) under a key name but only if it contains a substring "foobar":

.key("name").match("%foobar%").delete()

Delete values from a list

Lists are collections of values. Lists typically do not have keys. To remove an item from a list, we do it by-value.

Remove a value from a list named "name".

.list("name").delete("value")

Remove all values from a list named "name" that being with 2025.

.list("name").match("2025%").delete()

Reset a list. Removes all items from a list, effectively deleting that list. This would delete all entries from a list named "name"

.list("name").delete()

Time-To-Live (TTL)

All values submitted are disposable and are automatically destroyed after some time of inactivity (i.e. not accessed for some time). 90 days is the default, but the period can be made shorter, or longer with &ttl=[days] parameter - depends on your needs.

Deleting data

Data will purged when TTL is reached, so to erase all data immediately you can set it to be picked up during the very next garbage collection sweep by setting its time-to-live to 0

prefs_us.key("mydata").ttl(0).write("");

You don't have to wait for a period of inactivity to purge your data. You can pass a Time-To-Live directive with each .write() call, which will cause saved values to be purged - as in permanently deleted - after N number of days.

ttl=<number-of-days>

Example: the 'theme' setting for user janedoe will be erased after 15 days. Any other values associated with that key will not be affected - unless they also were set with an explicit ttl value.

let user = document.getElementById("inputbox").value;
let pass = document.getElementById("password").value;

prefs_us.getkey("my_key",[ user, pass, "?", "?" ])
            .key("theme")
            .ttl(15)
            .write('{"theme":"default-dark"}')

IMPORTANT: TTL parameter is enforced at a value level, meaning it only affects key/value pair, an object , or any piece of data it was assigned to and does not apply to other values associated with your key.