Set 1 | HLL 1 | Set 2 | HLL 2 | S1 ∪ S2 | HLL1 ∪ HLL2 | S1 ∩ S2 | HLL1 ∩ HLL2 |
---|---|---|---|---|---|---|---|
6987812 | 6997888 | 6962294 | 6951998 | 8550732 | 8553641 | 5399374 (63.000000%) | 5398755 (63.116455%) |
7141370 | 7158982 | 3678358 | 3684955 | 8546742 | 8547740 | 2272986 (26.000000%) | 2314317 (27.075192%) |
3124534 | 3107282 | 8651079 | 8604982 | 10227258 | 10230622 | 1548355 (15.000000%) | 1506744 (14.727785%) |
8850249 | 8862284 | 5290225 | 5308950 | 9375807 | 9387095 | 4764667 (50.000000%) | 4781208 (50.933841%) |
667001 | 665795 | 2030138 | 2019862 | 2217972 | 2209121 | 479167 (21.000000%) | 469897 (21.270768%) |
1344715 | 1355003 | 5560979 | 5585400 | 6788416 | 6799020 | 117278 (1.000000%) | 122419 (1.800539%) |
9527013 | 9539805 | 8888494 | 8904840 | 13514502 | 13547342 | 4901005 (36.000000%) | 4923976 (36.346436%) |
1336356 | 1347820 | 183299 | 183805 | 1432428 | 1439300 | 87227 (6.000000%) | 88551 (6.152 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# LVDB - LLOOGG Memory DB | |
# Copyriht (C) 2009 Salvatore Sanfilippo <[email protected]> | |
# All Rights Reserved | |
# TODO | |
# - cron with cleanup of timedout clients, automatic dump | |
# - the dump should use array startsearch to write it line by line | |
# and may just use gets to read element by element and load the whole state. | |
# - 'help','stopserver','saveandstopserver','save','load','reset','keys' commands. | |
# - ttl with milliseconds resolution 'ttl a 1000'. Check ttl in dump! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# bash completion for redis-cli and redis-server | |
have redis-server && | |
_redisserver() | |
{ | |
local cur prev split=false | |
COMPREPLY=() | |
_get_comp_words_by_ref cur prev |
A quick guide to write a very very simple "ECHO" style module to redis and load it. It's not really useful of course, but the idea is to illustrate how little boilerplate it takes.
Step 1: open your favorite editor and write/paste the following code in a file called module.c
#include "redismodule.h"
/* ECHO <string> - Echo back a string sent from the client */
int EchoCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
Look for a new #RedisTrivia fact every Thursday with your Redis Watch newsletter :)
Lifted with permission from the Redis Watch Archive: https://redislabs.com/redis-watch-archive
- Redis stands for REmote DIctionary Server
- everybody knows that Redis' default port is 6379, but have you ever wondered why? The answer is that 6379 spells MERZ on the phone's keypad (want to know what MERZ is? Read the appendix at http://oldblog.antirez.com/post/redis-as-LRU-cache.html [warning: slightly NSFW links inside])
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- @desc: Copy a key without knowing its type | |
-- @usage: redis-cli EVAL "$(cat COPY.lua)" 2 <key> <destKey> | |
local function COPY(key, dest) | |
local keyType = redis.call("TYPE", key) | |
if keyType == "set" then redis.call("SUNIONSTORE", dest, key) | |
elseif keyType == "zset" then redis.call("ZUNIONSTORE", dest, 1, key) | |
elseif keyType == "list" then redis.call("SORT", key, "BY", "NOSORT", "STORE", dest) | |
elseif keyType == "string" then redis.call("SET", dest, redis.call("GET", key)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
int | |
main() | |
{int h=9, | |
d=0,x;while | |
(h--){for(x=0; | |
x<39;x++){int a=x | |
-6;if(a<0)a=-a;printf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Two dashes start a one-line comment. | |
--[[ | |
Adding two ['s and ]'s makes it a | |
multi-line comment. | |
--]] | |
---------------------------------------------------- | |
-- 1. Variables and flow control. | |
---------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
NewerOlder