Storage
The Storage is a utility provided to all scripts(server scripts and spellbooks). By using the Storage, scripts can store info on the disk easily which will last when the server is shutdown.
The Storage is implemented as an YAML file. So for scripts, the Storage acts like a Hash.
To use the Storage, scripts will call:
stg=Storage.get(name) #name is a String!
And a Hash is returned for the scripts to store or retrieve values, like:
stg['name']='H2NCH2COOH' flag=stg['flag'] stg['list']=[1,2,3] stg['people']['tom']['name']='Tom' stg['people']['tom']['sex']='male'
Since the Storage is stored as an YAML file, only Strings can be used as keys and not everything can be used as values. Be aware.
The Storage is loaded to the memory from the file when the plugin is enabled, and will not write to the file until the plugin is disabled. Since the plugin has no idea of which value is useful and which is not, everything in the Storage will be saved to the YAML file. So use Storage carefully and make sure there is no leakage. And as the server admin, check the size of the file storage.yml in the plugin data folder and see if there is a leakage. If the file has grown too big, delete it and lose everything inside(Or if you're confident enough, edit the file and delete the garbage).
Comments