Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Improvement suggestion: locking shdict keys #212

Open
Thomas12 opened this Issue · 1 comment

2 participants

@Thomas12

As you might know: Session management without a locking mechanism can lead to data-corruption as parallel requests will cause race-conditions. Please add this feature:

res=shdict:lock_key(key);
res=shdict:unlock_key(key);

And for performance-reasons a combined command for the most obvious tasks:

data, res=shdict:lock_key_and_get(key);
res=shdict:set_and_unlock_key(key, data);

and do an auto-unlock for all keys still being locked for that request when the Lua-script ends.

Maybe one could also allow a security-auto-unlock after 30 seconds.
You just put a new int into your shdict node-structure and when it is 0 it is unlocked.
When it contains a timestamp > 0 it is locked and when now-timestamp>30 then ignore this previous lock when trying to lock it.
Locktime-limit can be set as second parameter in lock_key(key, lock_timeout) and lock_key_and_get(key, lock_timeout).

@agentzh
Owner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.