GreenwichDB | Faster Datastores | Wrapper

                       Introducing: GreenwichDB / Greenwich

Hello, human on earth! May I introduce you to GreenwichDB!

:warning: Found a bug? Contact us in the Discord Server. :warning:

What is Greenwich

Greenwich is a Studios on ROBLOX which makes games. The team currently is provided with 2 people, (Noobie and Salvage.) We’re very excited to make games and we also decided to make a Datastore Wrapper. Read more down below!

What is GreenwichDB?

General Information [1]

GreenwichDB is an Open Source Code Project. GreenwichDB is a Wrapper for ROBLOX Datastores. This wrapper is insanely fast, and your data is loaded in once you join your game.

Contributors:
Salvage_Dev: @hghguy
NoobieYT: @NoobiDerpieDev

Concept [2]

The concept of GreenwichDB is to provide one Datastore, and just one, in order to completely remove complications. It’s faster and lighter on the server, and efficient.

Installation [3]

Of course! We’ll guide you through every step, in order to succesfully install GreenwichDB into your ROBLOX game.

  1. Insert a ModuleScript into ServerStorage.
  2. Rename the ModuleScript to “Greenwich(without the " " marks.)
  3. Paste the following Code into the ModuleScript

Usage [4]

Now that you have GreenwichDB installed, we can guide through the usage of GreenwichDB. Sit tight!

1. Insert a Script into ServerScriptService.
2. Open the Script we just created, and paste in the following code to require GreenwichDB into your game.

local Storage = game:GetService("ServerStorage")
local Greenwich = require(Storage:WaitForChild("Greenwich"))

Let’s break this down. As you can see, we are getting ServerStorage and defining that as a variable, Storage. We then require the script Greenwich which is the ModuleScript we created earlier.

3. Creating a Datastore.

The first thing we have to do is “Create a DB”. Since we are actually never creating a Datastore - it happens once when the ModuleScript gets runned. So, what we are doing is we are just passing the custom key, which is the argument in the GetDB function.

Let’s use this in a real world example.

local Money = Greenwich:GetDB("Money")

In this code, we are going to be creating a new store - not a Datastore, a store, which is considered the first key allowing for us to use only one Datastore ever.

4. Setting some data

Setting data is probably the simplest but also the most complex thing. It has 3 options, allowing you to really customize how you want to save data.

What the arguments are?

    1. key - The key that the value should be saved to
    1. value - The value that should be saved to the key
    1. shouldSave - The value that decides if the Data should be saved to the DS and the cache or just the cache. It defaults to saving to both. If you use this and set shouldSave to false you will need to use :Save(key) to update the Datastore with the value that you have in the cache.

5. Getting data

Getting data is very easy, it’s a simple :Get(key).
Arguments:

    1. key - The key to search the *cache and *DS for.

6. API Reference

Woot woot, you’ve reached the part where all the functions are described.
DB:Get → Get a value from the cache or Datastore

  1. key - The key to search the cache and DS for.

DB:Set → Set a value to the cache, Datastore or both.

  1. key - The key to save to
  2. value - The value to save to the key
  3. shouldSave - The value that decides if the Data should be saved to the DS and the cache or just the cache. It defaults to saving to both. If you use this and set shouldSave to false you will need to use :Save(key) to update the Datastore with the value that you have in the cache.

DB:Delete → Delete something from the cache and Datastore.

  1. key - The key to delete from the cache and Datastore

DB:Has → Check if the Datastore or cache contains the key

  1. key - The key to search through the Datastore and cache to see if the key has a value assigned.

DB:Save → Save data that was in the cache to the Datastore. Should only be used if somewhere you set shouldSave to false in the Set function.

DB:Fetch → Fetching data from the Datastore and adding it to the queue.

  1. player - The player to fetch data from (e.g DB:Fetch(Player.UserId))

Greenwich:EndQueue → Run all requests defined in the queue. Should be used before server shutdown.
No arguments

If you have any questions, please join our Discord listed below!

7. The caching layer

The way the cache works is the fact that we prioritize getting data from the cache. This means you will do less Datastore requests, and if the value isn’t in the cache, we will add the value to the cache as soon as it is fetched. We do this because it allows us to speed up things massively, and only takes up a little bit of memory usage.

8. The queue system

The queue system ensures that your Datastore is faster (see the technical video listed below for a comparison) and will also ensure you get less errors. This means that you won’t get any Datastore Request queue handler errors, and if you ever do, that’ll be because you called EndQueue - which should only be called on server shutdown.

9. Conclusion

Greenwich is lightweight, has a simple and stable API and has various speed improvements. Enjoy!

History of GreenwichDB

The idea of GreenwichDB was originally made by @hghguy (Aka. Salvage_Dev), he immediately reached to @NoobiDerpieDev (aka. NoobieYT) and introduced me to the idea of GreenwichDB. We made GreenwichDB from scratch within 2 days, to make it usable & beginner friendly (we succeeded!)

Some Handy Links

Github: Greenwich · GitHub

ROBLOX: Greenwich - Roblox

Technical Video: - YouTube

Usage Video: ROBLOX STUDIO | How to use GreenwichDB [Instant Data Loading!] - YouTube

Discord: Greenwich

Thank you for looking at GreenwichDB!

Powered by Greenwich DarkLogoCircle

6 Likes

The most important question, how does this compete with Datastore2? And why shall we use this over Datastore2/ProfileService?

If we can’t create more than 1 datastore, its pretty problematic.

Although, This is a nice module.

2 Likes

Thanks for your feedback.

In my opinion, if you want to use Datastore2 or ProfileService, go ahead! Feel free to!

GreenwichDB was just a fun project to make Datastores a lil faster and personally, me and Salvage just use it for our personal games but we just thought to share it to the world, haha.

GreenwichDB itself is 1 Datastore, but you can use multiple keys, and you can use GreenwichDB everywhere in any Script!

Example:

GreenwichDB:GetDB("Money") -- datastore for your money.

GreenwichDB:GetDB("Checkpoint") --datastore for checkpoints

And so on.

How would 1 Datastore be problemetic?

We appreciate your feedback. :slight_smile:

1 Like

In the OP, you said only 1 datastore can be created.

But here 2 datastores are being created.

Are you storing different types of keys and values in 1 single datastore?

2 Likes

Exactly as you said. We are indeed storing different keys (with different data, atleast, that’s the idea of GreenwichDB) to Greenwich (1 datastore).

1 Like

Looks like a pretty neat system, especially with the queuing and caching. I’ve never really found myself using Datastore2 or ProfileService

2 Likes

Thank you so much for your feedback! We really appreciate it :tada:

1 Like