DataKeep - A promise based, auto-saving DataStore module

I don’t know much about promises, can you tell me how I can use KeepStore:andThen(function(store) inside Promise.new ?

Everything in this module returns a promise (or a Promise.new) so from there you can interact as you would with Promise.new

DataKeep.GetStore("PlayerData", defaultData):andThen(function(store)
       -- interact with store
end)
2 Likes

Issue was fixed by changing the SaveInterval in src to 5. I don’t know if there’s a way to have it save data when releasing the keep, but saving on an interval of 5 will make saving more consistent.

For future developers reading this:

You need to be releasing on leave and should resolve it.

1 Like

version 3.0.3: 01/06/2024

Fixed

  • Mockstore not returning version key

  • Mockstore yield detection flagged false

  • .Mock missing API

1 Like

version 3.0.4: 01/21/2024

Fixed

  • Impartial saving issues from Roblox’s :UpdateAsync() not working as intended
1 Like

version 3.0.5: 02/13/2024

Fixed

  • GlobalUpdates returning nil causing an error
1 Like

I keep having issues with the LoadKeep function. There is a “LoadKeep is not a valid member of DataStore “DataStoreService.PlayerData”.” error that pops up every time I test the game.

I also don’t know whether it is with the way I store things in the table or the way I create the folders. If you know how to solve it, please let me know.

1 Like

This seems like a user problem. Join the OSS discord and ask me there, can provide more help

edit: broken release. continue to use 3.0.5

  • Profiles do not automatically clean up internal connections, making the developer have to perform inconvenient clean-ups
  • ProfileService async calls make waiting for Profiles to be loaded difficult. Causing weird patterns when waiting for Profiles; DataKeep is promise-based

These aren’t really huge issues?
All you had to add to solve async calls was making your own promises etc, since ive added promises i have never had an issue with “waiting for profiles”

And if you look into the setup guide, connections are properly cleaned up

I never stated they were! Just preferences and somethings were bothering me so it created it.

Thats exactly what I did here. But just remade everything in ways I prefer.

You don’t have to use the module just preference

2 Likes

heyo, follow up to the broken version (3.0.6)

Please take note of the slight breaking change

version 3.1.0: 03/17/2024

Fixed

  • Mock detection fix

SLIGHT BREAKING CHANGE

  • GetStore now waits for mockstore detection to finish. Players.PlayerAdded events may fire before getstore is ready. Use a loop of current players first. (See Example)

version 3.1.1: 03/17/2024

Fixed

  • LoadCount not incrementing

Added

  • Class implementation to Usage docs

version 3.1.2: 05/28/2024

(bug fixes)

(finally)

version 3.2.0: 08/23/2024

  • Fixes #21

  • Adds Steal option to .LoadMethods

  • ForceLoad now waits for previous keep to save data

  • :ViewKeep() now correctly calls :GetAsync() and :GetVersionAsync()

  • Adds keep:Destroy() for cleaning :ViewKeep()

  • Adds TestEZ definitions

  • Adds more tests

  • Fixed global update edge case

  • Cancel :LoadKeep when server closing

  • Fix infinite session stealing

1 Like

version 3.2.1: 09/29/2024

  • Fixed no waiting between failed saves

version 4.0.0: 10/11/2024

Breaking Changes ! !

  • Changed globalUpdate.IDglobalUpdate.Id (Backwards compatible, shouldn’t have any data loss)

  • DataKeep:LoadStore() requires wrapper as third parameter (for strict types)

  • Default Wrapper now moved to DataKeep.Wrapper

  • CriticalStateSignal and IssueSignal moved to DataKeep.CriticalStateSignal and DataKeep.IssueSignal

  • .CriticalState.IsCriticalState

version 4.1.0: 10/22/2024

  • Add DataKeep.SetConfig()
  • Fixed Rbxm’s types

version 5.0.0: 12/09/2024

  • Add DataKeep.Enums
  • Default logLevel is now DataKeep.Enums.LogLevel.Warn
  • Add store:Identify()
  • Add store:RemoveKeep()
  • Add :LoadKeep() retrying
  • Fix .GetStore() returning wrong cached value
  • Functions made only for specific keep type are only visible for that type
  • Types are --!strict

Breaking Changes

  • Proper promise handling on loading, see basic usage docs
  • DataKeep.LoadMethodsDataKeep.Enums.LoadMethod
  • Added customization of the verbosity of the logging via DataKeep.Enums.LogLevel