Using redis like memcache where it replaces least used and expires

Showing 1-4 of 4 messages
Using redis like memcache where it replaces least used and expires Gitted 4/24/11 6:27 PM
I want to simplify my framework stack and just use redis instead of having to use both redis + memcached.

Now this is the first time me using either, but what I liked about memcached is (or rather how I think memcached works!) is that I can allocate say 5 GB of memory, and then just add things to the cache, and it will overrite keys in the cache if they are not being references often (LRU).

I read somewhere that redis can mimick this behavior.

I couldn't find a suitable page on redis.io about this....


Re: Using redis like memcache where it replaces least used and expires Mikhail Mikheev 4/25/11 12:15 AM
This article should help you: http://antirez.com/post/redis-as-LRU-cache.html
Re: Using redis like memcache where it replaces least used and expires Gitted 4/25/11 6:37 PM
So have these config settings changed??  Is this in the docs somewhere seeing as we are in 2.2.5

  • volatile-lru remove a key among the ones with an expire set, trying to remove keys not recently used.
  • volatile-ttl remove a key among the ones with an expire set, trying to remove keys with short remaining time to live.
  • volatile-random remove a random key among the ones with an expire set.
  • allkeys-lru like volatile-lru, but will remove every kind of key, both normal keys or keys with an expire set.
  • allkeys-random like volatile-random, but will remove every kind of keys, both normal keys and keys with an expire set.

Is there one that matches closely to what memcached does?


On Mon, Apr 25, 2011 at 3:15 AM, Mikhail Mikheev <michail...@mail.ru> wrote:
This article should help you: http://antirez.com/post/redis-as-LRU-cache.html

--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To post to this group, send email to redi...@googlegroups.com.
To unsubscribe from this group, send email to redis-db+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/redis-db?hl=en.


Re: Using redis like memcache where it replaces least used and expires Mikhail Mikheev 4/25/11 11:23 PM
> So have these config settings changed??  Is this in the docs somewhere
> seeing as we are in 2.2.5

Actually i don't know if there are any changes in expiration policies
in 2.2.5 as i'm still on 2.2.2. And i'm not sure whether the document
that describes them exists. But usually all the settings are described
in redis.conf file. For most settings it contains detailed
description.

> Is there one that matches closely to what memcached does?
I think you need allkeys-lru to make Redis act as memcached. AFAIK
memcached uses lru policy for every key it stores.

The only difference in Redis here is that it is possible to allow only
volatile keys be expired and keep other keys persistent in memory.
That is, in Redis all values doesn't expire on default until you
explicitly set time to live with command EXPIRE. Such keys for that
time to live is defined are called volatile. In some cases it can be
useful. For example you have a few keys that should never expire (e.g.
lookups or some resources that are not changed and you should be able
to read them fast at any time) so you can use policy volatile-lru to
make sure these keys will never be evicted. But if you decide to use
volatile-lru you should do it with care because if there are too many
keys that will never expire they may consume all the memory and there
will be no room to store volatile keys.