/// <summary> /// Retrieves a specific object in the database by an arbitrary key. /// </summary> /// <typeparam name="T">The type of data to retrieve</typeparam> /// <param name="key">The arbitrary key the data is stored under</param> /// <returns>The object stored in the database under the specified key</returns> public static T Get <T>(string key) { var json = NWNXRedis.Get(key); if (string.IsNullOrWhiteSpace(json)) { return(default);
/// <summary> /// Stores a specific object in the database by an arbitrary key. /// </summary> /// <typeparam name="T">The type of data to store</typeparam> /// <param name="entity">The data to store.</param> /// <param name="key">The arbitrary key to set this object under.</param> public static void Set <T>(string key, T entity) where T : EntityBase { var data = JsonConvert.SerializeObject(entity); NWNXRedis.Set(key, data); }