# CharacterAI Persistence ## Description A library for persisting character related state. It currently and temporarily uses a json datastore backend but will eventually connect to a character state persistence service. ## Example usage ```js import Persistence from '../main/index'; let pers = Persistence.getInstance(); // We could store the persistence keys in an enum object // for easier access const Keys = { DATA1: 'DATA1', }; // Here we retrieve the data for Keys.DATA1 // Any `get` for a given key within the same application // will return the same Node object instance pers.get(Keys.DATA1) .then( (node) => { // Node has key:string, data:any, and save(); // Here we can read/modify the data node.data.name = 'George'; node.data.age = 34; // This synchronizes the data with the datastore node.save(); }); ```