REDIS
Cache dan PubSub
Rifqi Alfian
@merembablas
kesibukan
@anakbelajar
Aplikasi belajar untuk anak usia dini
Cache Redis
• 2 cara :
TTL , Volatile Object
maxmemory
Redis as an LRU cache
Least Recently Used
konfigurasi
• maxmemory bytes
• maxmemory-policy policy
• maxmemory-samples jml_sample
Conf : maxmemory
• Bytes
1k => 1000 bytes
1kb => 1024 bytes
1m => 1000000 bytes
1mb => 1024*1024 bytes
1g => 1000000000 bytes
1gb => 1024*1024*1024 bytes
Conf : maxmemory-policy
• volatile-lru (default)
• allkeys-lru
• volatile-random
• allkeys-random
• volatile-ttl
• noeviction
Conf : maxmemory-samples
• Default : 3
• TTL dan LRU bukan ‘precise algorithms’
PubSub Redis
Command
• subscribe
• unsubscribe
• publish
• psubscribe
• punsubscribe
PSUBSCRIBE dan PUNSUBSCRIBE
• Glob pattern matching
• Ex :
PSUBSCRIBE news.*
match : news.art, news.world.war channel
Use Case
• Chat
• Notification System
• Message Queue
Terima Kasih
• Salvatore Sanfilippo
• Om Hiraq
• Om Wahyu
• NoSQL Indonesia
• PHP Indonesia

Slide NoSQL Indonesia - Redis Cache n PubSub