Skip to content
This repository has been archived by the owner on Aug 20, 2022. It is now read-only.

Synchronous option for KeyValueStore #18

Closed
rdev34 opened this issue Nov 18, 2020 · 0 comments · Fixed by #19
Closed

Synchronous option for KeyValueStore #18

rdev34 opened this issue Nov 18, 2020 · 0 comments · Fixed by #19
Assignees

Comments

@rdev34
Copy link
Collaborator

rdev34 commented Nov 18, 2020

Due to the asynchronous nature of KeyValueStore which uses callbacks, there are difficulties with organizing and structuring code that fetches multiple keys at once or certain keys in sequence. We can write simpler and more readable code with a synchronous option that would end up looking like this:

CreateThread(function()
    local value1 = KeyValueStore:Get({key = "Key1", synchronous = true})
    local value2 = KeyValueStore:Get({key = "Key2", synchronous = true})

    if value1 > value2 then
        print("my code looks so pretty!")
    end
end)

Note: This requires refactoring KVS:Get to use single arg table instead of positional args

@rdev34 rdev34 self-assigned this Nov 18, 2020
@rdev34 rdev34 linked a pull request Nov 25, 2020 that will close this issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant