Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is meaning of 0/cache in redis://localhost:6379/0/cache

While adding redis as my cache store in Rails app,

i added the redis url as redis://localhost:6379/0/cache.

What is the meaning of 0/cache in the redis URL?

like image 294
Prathamesh Sonpatki Avatar asked Dec 25 '13 05:12

Prathamesh Sonpatki


People also ask

What is the 0 at the end of Redis URL?

The database index is the number you see at the end of a Redis URL: redis://localhost:6379/0 . The default database is 0 but you can change that to any number from 0-15 (and you can configure Redis to support more databases, look in redis.

What is local Redis cache?

Redis is an open-source, in-memory data structure store that is used to implement key-value databases and application caches.

How do I know if Redis is running?

To start Redis client, open the terminal and type the command redis-cli. This will connect to your local server and now you can run any command. In the above example, we connect to Redis server running on the local machine and execute a command PING, that checks whether the server is running or not.


1 Answers

You may configure redis to use many databases.

The 0 means you are using the first of them (id=0).
The cache is the namespace of the database.

Depending on where you set this url, you are actually telling to use redis caching and values will be saved/retrieved etc from the database 0 and namespace cache.

like image 65
Lazarus Lazaridis Avatar answered Nov 15 '22 10:11

Lazarus Lazaridis