Create the file with the actual bytes, not the '\xnn\ representation. For example, in Python:
f = open('filename', 'w')
f.write('\x01\x02\x03')
f.close()
Load the file with redis-cli -x set keyname < filename
| -- Two dashes start a one-line comment. | |
| --[[ | |
| Adding two ['s and ]'s makes it a | |
| multi-line comment. | |
| --]] | |
| ---------------------------------------------------- | |
| -- 1. Variables and flow control. | |
| ---------------------------------------------------- |
Create the file with the actual bytes, not the '\xnn\ representation. For example, in Python:
f = open('filename', 'w')
f.write('\x01\x02\x03')
f.close()
Load the file with redis-cli -x set keyname < filename
| import requests | |
| import json | |
| jt = json.dumps({'trashed': True}) | |
| url = 'https://api.mention.net/api/accounts/<account identifier>/alerts/<alert identifier>/mentions' | |
| gh = {'Accept': 'application/json', 'Accept-Language': 'en', 'Authorization': 'Bearer <token>'} | |
| ph = gh.copy() | |
| ph['Content-Type'] = 'application/json' |
| foo@bar:~/src/quadtree$ redis-cli zcard x | |
| (integer) 100000 | |
| foo@bar:~/src/quadtree$ redis-cli zcard y | |
| (integer) 100000 | |
| foo@bar:~/src/quadtree$ redis-cli hlen qt | |
| (integer) 56325 | |
| foo@bar:~/src/quadtree$ redis-cli script load "`cat rqtih.lua`" | |
| "84f91fddf261e9a2ef14ff4b417443eed3dc4b2b" | |
| foo@bar:~/src/quadtree$ redis-benchmark -n 100 -r 1000000 evalsha 84f91fddf261e9a2ef14ff4b417443eed3dc4b2b 3 x y tmp zquery __rand_int__ __rand_int__ __rand_int__ __rand_int__ | |
| ====== evalsha 84f91fddf261e9a2ef14ff4b417443eed3dc4b2b 3 x y tmp zquery __rand_int__ __rand_int__ __rand_int__ __rand_int__ ====== |
| foo@bar:~/memtier_benchmark$ ./memtier_benchmark -p 11211 -P memcache_text -x 1 | |
| [RUN #1] Preparing benchmark client... | |
| [RUN #1] Launching threads now... | |
| [RUN #1 100%, 46 secs] 0 threads: 2000000 ops, 44427 (avg: 43467) ops/sec, 1.27MB/sec (avg: 1.24MB/sec), 4.50 (avg: 4.58) msec latency | |
| 4 Threads | |
| 50 Connections per thread | |
| 10000 Requests per thread | |
| Type Ops/sec Hits/sec Misses/sec Latency KB/sec | |
| ------------------------------------------------------------------------ |
Slidedeck: https://www.slideshare.net/itamarhaber/use-redis-in-odd-and-unusual-ways
Ask a Redis Expert Webinar - Why Your MongoDB Needs Redis: http://www.slideshare.net/itamarhaber/why-your-mongodb-needs-redis
"Went up the mountain, spent some time there, a bush or something was burning and I must have inhaled the smoke because I came back down carrying these two slabs of stone...", HippieLogLog
I. I am thy open source, BSD licensed, data structure store
II. Thou shalt have no other data but that which fits in RAM
| -- Returns a key's absolute TTL | |
| local t = tonumber(redis.call('TTL', KEYS[1])) | |
| if t > 0 then | |
| t = t + tonumber(redis.call('TIME')[1]) | |
| end | |
| return t |
| foo@bar:~$ redis-cli | |
| 127.0.0.1:6379> flushall | |
| OK | |
| 127.0.0.1:6379> save | |
| OK | |
| 127.0.0.1:6379> set p persistent | |
| OK | |
| 127.0.0.1:6379> set v volatile | |
| OK | |
| 127.0.0.1:6379> expire v 99999999 |