Redis set vs hash

Redis hashes are good for storing more complex data, like you suggest in your question. I use them for exactly that – to store objects with multiple attributes that need to be cached (specifically, inventory data for a particular product on an e-commerce site). Sure, I could use a concatenated string – but that adds … Read more

How does redis expire keys?

In short – for each redis object, there is an expiration time. Unless you set the object to expire, that time is “never”. Now, the expiration mechanism itself is semi-lazy. Lazy expiration means that you don’t actually expire the objects until they are read. When reading an object, we check its expiration timestamp, and if … Read more

How to get all keys with their values in redis

There is no native way of doing this. The Redis command documentation contains no native commands for getting the key and value of multiple keys. The most native way of doing this would be to load a lua script into your redis using the SCRIPT LOAD command or the EVAL command. Bash Haxx solution A … Read more

How to disable persistence with redis?

To disable all data persistence in Redis do the following in the redis.conf file: Disable AOF by setting the appendonly configuration directive to no (it is the default value). like this: appendonly no Disable RDB snapshotting by commenting all of the save configuration directives (there are 3 that are defined by default) and explicitly disabling … Read more

Redis: Show database size/size for keys

So my solution to my own problem: After playing around with redis-cli a bit longer I found out that DEBUG OBJECT <key> reveals something like the serializedlength of key, which was in fact something I was looking for… For a whole database you need to aggregate all values for KEYS * which shouldn’t be too … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)