Before you start
- Your plan: Growth (64 MB), Business (128 MB) or Pro (256 MB) of PHP, Node.js, Python or Java hosting.
- Dashboard → Databases → Redis → Turn Redis on. The page shows host 127.0.0.1, port, password, a Unix socket path and REDIS_URL.
- For Node.js, Python and Java apps, press “Add these settings to my app” — the variables are added and the app restarts once.
- Only your hosting account can connect; the password is always required.
Spring Boot
Add spring-boot-starter-data-redis (and spring-boot-starter-cache for @Cacheable). Spring Boot’s relaxed binding reads SPRING_DATA_REDIS_HOST, SPRING_DATA_REDIS_PORT and SPRING_DATA_REDIS_PASSWORD from the environment, so after “Add these settings to my app” no properties are needed. Add @EnableCaching to a configuration class and spring.cache.type=redis; set a default TTL with spring.cache.redis.time-to-live=10m.
Sessions: add spring-session-data-redis and set spring.session.store-type=redis (Spring Boot 3 detects it automatically). Lettuce, the default client, connects over TCP to 127.0.0.1 and the port shown.
Laravel and PHP
The phpredis extension is installed on every PHP version. In .env set REDIS_CLIENT=phpredis, REDIS_HOST=127.0.0.1, REDIS_PORT and REDIS_PASSWORD from the Redis page, then CACHE_STORE=redis, SESSION_DRIVER=redis and QUEUE_CONNECTION=redis, and run php artisan config:cache. Queue workers can run from a cron job (php artisan queue:work --stop-when-empty every minute) on our hosting.
Plain PHP: $r = new Redis(); $r->connect('127.0.0.1', PORT); $r->auth(PASSWORD);.
Django, Flask and FastAPI
Django 4+ has a built-in Redis cache backend: CACHES = {"default": {"BACKEND": "django.core.cache.backends.redis.RedisCache", "LOCATION": os.environ["REDIS_URL"]}}. Store sessions in it with SESSION_ENGINE = "django.contrib.sessions.backends.cache" (or cached_db to keep a database copy).
Flask and FastAPI: install redis (redis-py) and create a client with redis.Redis.from_url(os.environ["REDIS_URL"]); the asyncio client is redis.asyncio.from_url. Celery can use REDIS_URL as its broker for light background jobs.
Node.js (Express, NestJS, Next.js)
ioredis or node-redis: new Redis(process.env.REDIS_URL), or the Unix socket for the lowest latency: new Redis({ path: process.env.REDIS_SOCKET, password: process.env.REDIS_PASSWORD }). Sessions with connect-redis; NestJS caching with the cache-manager Redis store; job queues with BullMQ, which needs maxRetriesPerRequest: null on its connection.
Next.js: use Redis from route handlers or server actions for rate limits and cached API results; the incremental cache can stay on disk.
Good key design and limits
When memory is full, the least recently used keys are removed (allkeys-lru). Watch evictions on the dashboard’s Redis page; frequent evictions mean you need a larger plan or shorter TTLs.
| Practice | Why |
|---|---|
| Prefix keys by app and type (shop:product:42) | Easy to find, flush or measure one kind of data |
| Always set a TTL on cache keys | Stale data expires on its own |
| Keep values small (under a few hundred KB) | Large values slow every reader and fill memory |
| Do not use KEYS * in production | It scans everything; use SCAN |
| Keep the source of truth in your database | Redis is a cache and evicts when full |
Security on shared hosting
Each Cloud Ninza hosting account runs its own Redis as its own Linux user, inside the account’s memory limit. Connections from other accounts are refused by the server firewall and the socket’s permissions, the internet cannot reach it, a password is always required, and administrative commands such as CONFIG and MODULE are disabled. Snapshots are saved in your home folder and included in the twice-daily backups.
Key takeaways
The short version, for anyone skimming:
- Turn Redis on, press “Add these settings to my app”, and most frameworks connect with no code changes.
- Spring Boot reads SPRING_DATA_REDIS_*; Django, Flask, FastAPI and Node.js read REDIS_URL; Laravel uses .env and phpredis.
- Use it for cache, sessions, rate limits and light queues; keep important data in your database.
- Prefix keys, set TTLs and watch evictions.
- Included with Growth, Business and Pro plans of PHP, Node.js, Python and Java hosting.
Java Hosting
Java hosting on cloud servers in India from ₹299 a month, billed yearly. Backups twice a day (12 AM and 12 PM), last 30 days kept — restore any date yourself from your dashboard, or make your own backup any time · Spam protection: hourly and daily email sending limits per project, and automatic pausing of spam-like sending, keep your domain and our mail servers trusted · OpenJDK 11, 17, 21 or 25.
Hosting from ₹149 a month on servers in India
WordPress, static HTML, PHP, Node.js, Python and Java plans with free SSL and your choice of version. Create your account, pick a plan and pay by UPI, card or netbanking; your hosting is created automatically and you get your login by email, usually within minutes.