চূঁড়ান্তভাবে Redis RAM-এ ডেটা সংরক্ষণ করে, memory management অত্যন্ত গুরুত্বপূর্ণ — maxmemory সীমা, eviction policies, মেমোরি অপ্টিমাইজেশন এবং মনিটরিং বোঝা Redis নির্ভরযোগ্যভাবে চালানোর জন্য অপরিহার্য যাতে মেমোরি শেষ না হয়ে যায়।
maxmemory এবং eviction
Set a memory limit so Redis doesn't consume all RAM:
maxmemory 2gb # cap Redis at 2GB
maxmemory-policy allkeys-lru # what to do when the limit is reached
When the limit is hit, Redis EVICTS keys per the policy (or rejects writes):
allkeys-lru → evict least-recently-used (any key) — common for a pure cache
allkeys-lfu → evict least-frequently-used
volatile-lru → evict LRU among keys WITH a TTL only
volatile-ttl → evict keys closest to expiry
noeviction → reject writes when full (good if Redis holds important data)
