Comments (3)
cc @tidwall
from summitdb.
Unfortunately I don't have any plans for adding list commands at this time.
One idea is to use the json commands inside a script.
For example and RPUSH could be:
> script load "sdb.call('set', KEYS[0], '[]', 'nx');sdb.call('jset', KEYS[0], '-1', ARGV[0]);return parseInt(sdb.call('jget', KEYS[0], '#'));"
"95e4005b8d5dff3778154ae39dd819a21c363d13"
Then you can use the script like:
> evalsha 95e4005b8d5dff3778154ae39dd819a21c363d13 1 mylist item1
1
> evalsha 95e4005b8d5dff3778154ae39dd819a21c363d13 1 mylist item2
2
> evalsha 95e4005b8d5dff3778154ae39dd819a21c363d13 1 mylist item3
3
> evalsha 95e4005b8d5dff3778154ae39dd819a21c363d13 1 mylist item4
4
For LPOP:
> script load "var res = sdb.call('jget', KEYS[0], '0');sdb.call('jdel', KEYS[0], '0');return res;"
"e3f15d9503ca033132d0e83b35ec3afcf28ef922"
> evalsha e3f15d9503ca033132d0e83b35ec3afcf28ef922 1 mylist
"item1"
> evalsha e3f15d9503ca033132d0e83b35ec3afcf28ef922 1 mylist
"item2"
> evalsha e3f15d9503ca033132d0e83b35ec3afcf28ef922 1 mylist
"item3"
> evalsha e3f15d9503ca033132d0e83b35ec3afcf28ef922 1 mylist
"item4"
> evalsha e3f15d9503ca033132d0e83b35ec3afcf28ef922 1 mylist
(nil)
The underlying data is just a json array. So you can get the entire list with a GET:
> evalsha 95e4005b8d5dff3778154ae39dd819a21c363d13 1 mylist item1
1
> evalsha 95e4005b8d5dff3778154ae39dd819a21c363d13 1 mylist item2
2
> GET mylist
"[\"item1\",\"item2\"]"
from summitdb.
thanks
from summitdb.
Related Issues (20)
- Q: read the last FENCE token without incrementing? HOT 1
- missing server means new leader complains forever; needs to avoid spamming its logs HOT 2
- Q: transactions or pipelined commands? HOT 3
- can't create cluster over localhost:7777 tunneled connection HOT 5
- Unable to join cluster HOT 9
- Is it (already) possible to retrieve a list of all the peers for a cluster? HOT 5
- Getting Started - FreeBSD Incorrect Download Path HOT 6
- Can't join cluster: "peer already known" HOT 2
- how to implement distributed lock with fencing tokens? HOT 1
- Kubernetes Statefulset
- Will you support authentication and TLS? HOT 1
- active project? HOT 1
- FYI: works fine on AArch64... HOT 1
- Q: SummitDB as embedded DB? HOT 1
- Question: what happened when out of memory? HOT 2
- Is it neccessary to open buntdb in file mode? HOT 3
- What happend when a command is committed but has errors when apply it? HOT 3
- The raft.db will grow unlimitedly? HOT 1
- Docs mention Lua eventhough Javascript is used
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from summitdb.