OSRS Plugin API
    Preparing search index...

    Namespace Persistence

    This section is for persistence, or saving information, and its functions. These commands will allow you to save information, retrieve information, or clear past saved data in your own plugin. Let's say you want to create a plugin that will save the users favorite colour. These functions will allow you to keep track of that information, overwrite it if the colour choice changes, and hold onto the information even after the plugin is closed.

    There is not a hard limit to key-value size, or total key-count. However, as a general guideline, we suggest keeping plugin storage to less than 10MB, and individual keys to less than 250KB.

    There are three functions that you will use when working with Persistence. setValue, getValue, and clear. Lets go over how each of these work with an example so you can start saving information in your own plugin.

    setValue: This function allows you to save any type of information under a "key". Imagine you have a key with a specific name, like "colourKey", and a favorite colour that you want to save, "blue". In order to save that information you would use setValue and save "blue" under your key, "colourKey". Then anytime you want to get your favorite colour all you need to do is use the key you made for it.

    getValue: This function allows you to get any information that has been previously saved in your plugin. Lets continue using the favorite colour example. Imagine you already saved a user's favorite colour, and now you want to retrieve that information. All you need to do is use this function and give it the key to unlock the save data. In this example you would just need to give getValue "colourKey", and it would return "blue".

    clear: This function allows you to clear all past saved information. Lets in your plugin the user wants to erase what their favorite colour is. All you would need to do is use this command and all saved information would be gone. Then if you were to try and use "colourKey" nothing would happen, because nothing would be saved under it.

    Using these three functions you will be able to save and keep track of all types of information in your own plugin.

    Functions

    clear
    getValue
    setValue