since redis Joined the module After the function ,redis The ecology is interesting , The big boys in every field will give it in the form of plug-ins redis Extend some new functionality , Like this one rediSQL,rebloom.

One :rediSQL

1. background

redis It's awesome , But there were plenty of jokes redis Too weak operability , Let's say you want to be in redis The implementation of a more complex business logic , It could be a disaster for you , Some students can speak English redis Of

stored procedure lua scatter , however lua Not every programmer can , Not to mention the data analysts , But if you ask sql Will the , Basically qualified programmers and analysts are fine with this , If you really let sql

Fall in the redis On , That's like a tiger with wings , Possibly the earliest sql Fall on redis Upper , Should be spark sql Well , Give Way redis As spark Of rdd, But here we're talking about another pass module Realized sql on redis.

2. download

The source code can go to github:https://github.com/RedBeardLab/rediSQL  , Download address is :https://github.com/RedBeardLab/rediSQL/releases

Download the compiled file directly , Just use it .

3. load

This simple , The first rediSQL_0.7.1.so Import to centos in , And then just use module load  rediSQL_0.7.1.so return ok that will do .

1 [root@localhost redis]# ls
2 00-RELEASENOTES COPYING Makefile README.md redis.conf runtest src
3 appendonly.aof deps MANIFESTO redis-check-aof rediSQL_0.7.1.so runtest-cluster tests
4 BUGS dump.rdb module redis-check-rdb redis-server runtest-sentinel utils
5 CONTRIBUTING INSTALL mydata redis-cli redis-trib.rb sentinel.conf
[root@localhost redis]# ./redis-cli
127.0.0.1:6379> module load /data/redis/rediSQL_0.7.1.so
OK

4. Easy to use

If want to let sql Fall on redis in , That has to build a library to build a table first , here database:Datamip, table:customer, Then I did a simple query , as follows :

127.0.0.1:6379> REDISQL.CREATE_DB Datamip
OK
127.0.0.1:6379> REDISQL.EXEC Datamip "CREATE TABLE customer(id int, username varchar(10));"
1) DONE
2) (integer) 0
127.0.0.1:6379> REDISQL.EXEC Datamip "INSERT INTO customer VALUES(1, 'jack');"
1) DONE
2) (integer) 1
127.0.0.1:6379> REDISQL.EXEC Datamip "INSERT INTO customer VALUES(2, 'mary');"
1) DONE
2) (integer) 1
127.0.0.1:6379> REDISQL.EXEC Datamip "SELECT * FROM customer WHERE id=2"
1) 1) (integer) 2
2) "mary"
127.0.0.1:6379>

Isn't it a great feeling , But the author has to eat , So the enterprise version or to collect money at the bottom of the box .

Two : rebloom

1. background

This module And it's interesting , It gives redis Two filters have been added , A place called bloom filter, A place called cuckoo filter, bloomfilter You probably know that , With a minimal error rate

The original HashSet Of 1/8 -1/4 Space utilization of , Let's see what happens ,cuckoofilter Which translates to cuckoo filter , Maybe the author's family raised birds , How else could there be so many birds ,

You just have to understand cuckoofilter Than bloomfilter More save a space , Lower error rate , And still support delete .

You can look at the paper specifically :http://www.cs.cmu.edu/~binfan/papers/conext14_cuckoofilter.pdf .

2. download

github Address :https://github.com/RedisLabsModules/rebloom    And then find release Pattern , After downloading the need for their own make once .

[root@localhost module]# ls
v1.1.0.tar.gz
[root@localhost module]# tar -xzvf v1.1.0.tar.gz
rebloom-1.1.0/
rebloom-1.1.0/.circleci/
rebloom-1.1.0/.circleci/config.yml
rebloom-1.1.0/.clang-format
rebloom-1.1.0/.gitignore
rebloom-1.1.0/Dockerfile
rebloom-1.1.0/LICENSE
rebloom-1.1.0/Makefile
rebloom-1.1.0/README.md
rebloom-1.1.0/contrib/
rebloom-1.1.0/contrib/MurmurHash2.c
rebloom-1.1.0/contrib/bloom.c
rebloom-1.1.0/contrib/bloom.h
rebloom-1.1.0/contrib/murmurhash2.h
rebloom-1.1.0/docs/
rebloom-1.1.0/docs/Bloom_Commands.md
rebloom-1.1.0/docs/CNAME
rebloom-1.1.0/docs/Cuckoo_Commands.md
rebloom-1.1.0/docs/Java_Client.md
rebloom-1.1.0/docs/Quick_Start.md
rebloom-1.1.0/docs/_config.yml
rebloom-1.1.0/docs/index.md
rebloom-1.1.0/mkdocs.yml
rebloom-1.1.0/ramp.yml
rebloom-1.1.0/src/
rebloom-1.1.0/src/cf.c
rebloom-1.1.0/src/cf.h
rebloom-1.1.0/src/cuckoo.c
rebloom-1.1.0/src/cuckoo.h
rebloom-1.1.0/src/print_version.c
rebloom-1.1.0/src/rebloom.c
rebloom-1.1.0/src/redismodule.h
rebloom-1.1.0/src/sb.c
rebloom-1.1.0/src/sb.h
rebloom-1.1.0/src/version.h
rebloom-1.1.0/tests/
rebloom-1.1.0/tests/Makefile
rebloom-1.1.0/tests/cuckoo.py
rebloom-1.1.0/tests/pytests.py
rebloom-1.1.0/tests/test-basic.c
rebloom-1.1.0/tests/test-cuckoo.c
rebloom-1.1.0/tests/test-perf.c
rebloom-1.1.0/tests/test.h
[root@localhost module]# ls
rebloom-1.1.0 v1.1.0.tar.gz
[root@localhost module]# cd rebloom-1.1.0
[root@localhost rebloom-1.1.0]# ls
contrib Dockerfile docs LICENSE Makefile mkdocs.yml ramp.yml README.md src tests
[root@localhost rebloom-1.1.0]# make
cc -Wall -Wno-unused-function -g -ggdb -O2 -fPIC -std=gnu99 -D_GNU_SOURCE -I/data/redis/module/rebloom-1.1.0 -I/data/redis/module/rebloom-1.1.0/contrib -c -o /data/redis/module/rebloom-1.1.0/src/rebloom.o /data/redis/module/rebloom-1.1.0/src/rebloom.c
cc -Wall -Wno-unused-function -g -ggdb -O2 -fPIC -std=gnu99 -D_GNU_SOURCE -I/data/redis/module/rebloom-1.1.0 -I/data/redis/module/rebloom-1.1.0/contrib -c -o /data/redis/module/rebloom-1.1.0/contrib/MurmurHash2.o /data/redis/module/rebloom-1.1.0/contrib/MurmurHash2.c
cc -Wall -Wno-unused-function -g -ggdb -O2 -fPIC -std=gnu99 -D_GNU_SOURCE -I/data/redis/module/rebloom-1.1.0 -I/data/redis/module/rebloom-1.1.0/contrib -c -o /data/redis/module/rebloom-1.1.0/src/sb.o /data/redis/module/rebloom-1.1.0/src/sb.c
cc -Wall -Wno-unused-function -g -ggdb -O2 -fPIC -std=gnu99 -D_GNU_SOURCE -I/data/redis/module/rebloom-1.1.0 -I/data/redis/module/rebloom-1.1.0/contrib -c -o /data/redis/module/rebloom-1.1.0/src/cf.o /data/redis/module/rebloom-1.1.0/src/cf.c
In file included from /data/redis/module/rebloom-1.1.0/src/cf.c:6:0:
/data/redis/module/rebloom-1.1.0/src/cuckoo.c: In function ‘CuckooFilter_Count’:
/data/redis/module/rebloom-1.1.0/src/cuckoo.c:157:9: warning: passing argument 1 of ‘filterCount’ from incompatible pointer type [enabled by default]
ret += filterCount(filter->filters[ii], &params);
^
/data/redis/module/rebloom-1.1.0/src/cuckoo.c:139:15: note: expected ‘const uint8_t (*)[2]’ but argument is of type ‘uint8_t (*)[2]’
static size_t filterCount(const CuckooBucket *filter, const LookupParams *params) {
^
ld /data/redis/module/rebloom-1.1.0/src/rebloom.o /data/redis/module/rebloom-1.1.0/contrib/MurmurHash2.o /data/redis/module/rebloom-1.1.0/src/sb.o /data/redis/module/rebloom-1.1.0/src/cf.o -o /data/redis/module/rebloom-1.1.0/rebloom.so -shared -Bsymbolic -Bsymbolic-functions -lm -lc
[root@localhost rebloom-1.1.0]# ls
contrib Dockerfile docs LICENSE Makefile mkdocs.yml ramp.yml README.md rebloom.so src tests

The last one in red rebloom.so That's the load file you're ultimately looking for .

[root@localhost redis]# ./redis-cli
127.0.0.1:6379> module load /data/redis/module/rebloom-1.1.0/rebloom.so
OK

3.   Easy to use

《1》 bloomfilter Simple use , Such as into 1,2,3,4 . Judge 3,5 Whether or not , as follows :

127.0.0.1:6379> bf.add myfilter 1
(integer) 1
127.0.0.1:6379> bf.add myfilter 2
(integer) 1
127.0.0.1:6379> bf.add myfilter 3
(integer) 1
127.0.0.1:6379> bf.add myfilter 4
(integer) 1
127.0.0.1:6379> bf.exists myfilter 3
(integer) 1
127.0.0.1:6379> bf.exists myfilter 5
(integer) 0
127.0.0.1:6379>

《2》 stay github Of quickstart I didn't find it cuckoofilter How to use , It doesn't matter" , Just look for the source file .

For example, the following source code is to tell you how to use .

And then we can do something simple add,delete,exists La .

127.0.0.1:6379> cf.add myfilter2 1
(integer) 1
127.0.0.1:6379> cf.add myfilter2 2
(integer) 1
127.0.0.1:6379> cf.add myfilter2 3
(integer) 1
127.0.0.1:6379> cf.add myfilter2 4
(integer) 1
127.0.0.1:6379> cf.del myfilter 2
(error) Not found
127.0.0.1:6379> cf.del myfilter2 2
(integer) 1
127.0.0.1:6379> cf.exists myfilter2 1
(integer) 1

Okay , So that's what this is about module, It's kind of interesting .

have a look redis The funny ones in the movie module (sql on redis, bf/cf on redis) More articles about

  1. redis Medium key Set expiration time

    EXPIRE key seconds For a given   key   Set the lifetime , When   key   expires ( Survival time:   0  ), It will be automatically deleted . stay Redis in , With time to live   key   go by the name of 『 Volatile ...

  2. redis Use in java Scripts implement distributed locks

    Reproduced in :http://www.itxuexiwang.com/a/shujukujishu/redis/2016/0216/115.html?1455860390 edis It's widely used in distributed environments , since ...

  3. Redis Data objects in

    redis object redis There are five common objects in Most of the object types we talk about are value types , Most of the key types are string objects , There are several types of value , But either is based on redisObject Realized redisObjec ...

  4. Redis in redis.conf Configuration detailed analysis

    ########################################### Basic configuration ##################################### # port port 666 ...

  5. New posture !Redis Call in Lua Script to implement atomic operations

    background : There is a service provider Leader, There are multiple message subscribers Workers.Leader It's a queuing process , Maintains a user queue , When a resource is idle and allocated to users in the queue ,Leader Push messages to subscribers ( The message carries a message ...

  6. Java WeChat official account development ---- Time acquisition access_token And save to redis in

    I originally wanted to do the operation of creating, modifying and deleting WeChat official account menu , But finding out needs to be access_token, By reading the document , The following requirements are found in the document : 1.access_token Valid for 2 Hours 2.access_ ...

  7. How to make redis Hot data is stored in the database ?

    When redis When the memory used exceeds the set maximum memory , Will trigger redis Of key Elimination mechanism , stay redis3.0 Medium 6 The elimination strategy is as follows : (1)noeviction : Do not delete policy . When the maximum memory limit is reached , If you need to use more ...

  8. 【PHP】 How to integrate SESSION Data stored in Redis in

    stay php in ,SESSION By default, the data is stored in a file , This way, the performance is not only low , And it's not conducive to expansion . After building the cluster , It's not applicable if it's stored in a file by default . therefore , We usually SESSION Customize , Give Way SESSION The data in is stored in   Count ...

  9. Redis in BitMap Usage scenarios of

    BitMap BitMap The original meaning is to use a bit to map the state of an element . Because a bit can only represent 0 and 1 Two kinds of state , therefore BitMap The states that can be mapped are finite , But the advantage of using bit is that it can save a lot of memory space ...

Random recommendation

  1. iOS Swift- Notes and semicolons

    iOS Swift- Notes and semicolons notes Annotation is a way of interpretation that exists in every language ,Swift The comments and C Language annotations are very similar , Single line notes using //. // This is a comment stay Swift You can also use multiline comments in , The starting tag uses ( ...

  2. eclipse install JS plug-in unit

    stay eclipse There are three Javascript Plug in options : JSDT JSEclipse Spket Spket Plug in installation : Manual installation : To http://www.spket.com/download.ht ...

  3. Points on cycle

    Description There is a cycle with its center on the origin. Now give you a point on the cycle, you a ...

  4. jquery Insert rows dynamically

    It's a use of jquery Dynamically insert input code . html Code : <div title=" table 2" class="ui-edit" style=" ...

  5. Java Determine how many palindrome strings there are and the largest of them

    One . Introduction code function The function of the code can be achieved on any string to determine whether there is palindrome , What are the palindromes , And the largest palindrome . Two . Code section 1. Global variables static String hws = "" ...

  6. Java Virtual machine interview focus ------------- Memory allocation and recycling strategies

    1 The priority of objects is Eden District Priority is given to Eden Distribute , Most of the time , The object is the new generation Eden District Distribution . When Eden There is not enough space to allocate , A virtual opportunity is launched Minor GC. The new generation GC(Ninor ...

  7. excel Export using get The request parameter is too long

    Problems encountered : excel When exporting functions , It uses window.location.href=url That is to say get request . When the input parameter is too long, it will be reported 414, The address is too long . Solutions : take get The request is replaced by post please ...

  8. android- Read MediaProvider

    1.MediaProvider Store media files in your phone , use SQLite The database stores pictures . video . Audio and other multimedia file information , For video player . Music player . Library usage . With root Access to adb shell, Use ...

  9. luogu4187

    P4187 [USACO18JAN]Stamp Painting Examples input3 2 2output6 input6 10 5output190 sol: First of all, we can find , For legitimate sequences , As long as there is a string to ...

  10. my Android The way —— The implementation of the bottom menu bar

    The implementation of the bottom menu bar There are two ways to implement the bottom menu bar :ViewPager: Sliding interface :Fragment: Fixed interface . First , The page layout , At the top toolbar after , Divide the main interface into two parts , One part is the interface display area , Another ...