Redis Integration
Shared Redis ORM cache and session store for Odoo 19. Eliminates per-worker cache duplication, enables true multi-server deployments without sticky sessions, and makes cache invalidation a single atomic operation - all with graceful fallback if Redis is unavailable.
Why You Need This
Without Redis
- Each Odoo worker builds its own ORM cache independently - 8 workers = 8Ã the PostgreSQL queries
- Workers never share cache invalidations - stale data lingers per-process
- Sessions stored as files on disk - breaks load-balanced multi-server setups
- Every restart forces all workers to warm caches from scratch
- Disk I/O on every session read/write slows down each HTTP request
With Redis
- All workers share one cache - Worker 2 gets what Worker 1 already fetched in microseconds
- Cache invalidation is instant across all processes - one INCR command, O(1)
- Sessions in Redis - any server handles any request, no sticky sessions needed
- Warm cache survives worker restarts via Redis persistence
- Sliding TTL keeps active users logged in; anonymous sessions auto-expire in 3 h
Key Features
Shared ORM Cache
Replaces per-worker in-memory LRU caches with a single Redis-backed cache shared by all workers and servers. Fewer PostgreSQL round-trips, faster responses.
Generation-Counter Invalidation
Cache clear is a single atomic INCR - no SCAN, no DEL storm, no race conditions. Old keys become invisible instantly and expire on their own TTL.
Redis Session Store
Sessions live in Redis, not the filesystem. Any server handles any request - no sticky sessions required, ideal for load-balanced and cloud deployments.
Dual TTL Sessions
Authenticated users stay logged in for 7 days (sliding). Anonymous visitors expire after 3 hours. Both configurable. Redis cleans up automatically - no GC jobs.
Redis Sentinel Support
Production HA via Redis Sentinel. If the primary Redis fails, Sentinel automatically promotes a replica. Configure via environment variables.
Graceful Fallback
If Redis is unreachable at startup, Odoo continues with its default in-memory LRU cache and filesystem sessions. Nothing crashes. Errors are logged clearly.
TLS Support
Use rediss:// URLs for encrypted connections. Works with Upstash, Redis Cloud, and your own TLS-enabled Redis instance.
JSON Session Encoding
Session data is stored as JSON (not pickle) - human-readable in redis-cli, safe from arbitrary code execution, with full datetime/set type support.
Multi-DB Aware
Each database gets its own Redis key namespace. Running 10 databases on one Odoo instance? Each gets an isolated ORM cache with no key collisions.
How It Works
ORM Cache Sub-System
res.users field definitions from PostgreSQL and stores them locally.
Worker 2 does the same - it doesn't know Worker 1 already did it.With this module: The module monkey-patches
Registry.init at server startup.
After Odoo builds its internal __caches dict, we swap each LRU instance with a
RedisLRU - a drop-in dict-compatible class that stores every entry in Redis.
Worker 2 gets the same data Worker 1 stored, instantly, from RAM.
cache.clear(), we INCR a counter. All old keys become unreachable and expire on their own TTL.
One atomic Redis command replaces what would be a slow SCAN + DEL loop.
Session Store Sub-System
~/.local/share/Odoo/sessions/. If your load balancer routes a request to Server 2
but the session was created on Server 1, the file is missing - the user gets logged out.With this module: We replace
http.Application.session_store
(a cached_property) with a RedisSessionStore before the first HTTP
request arrives. Every server reads and writes sessions to the same Redis. Any server handles
any request. No sticky sessions. No logout surprises.
get() call refreshes the session TTL.
Active users are never logged out mid-session. The TTL countdown only starts when the
user truly stops using Odoo.
Key Namespace Layout
{db_name}_{bucket}_generation invalidation counter (no expiry)
{db_name}_{bucket}_{gen}_{key} cached value (TTL: 7 days)
Session Store (Redis DB 1)
session:{prefix}:{sid} JSON session (TTL: 7 days auth / 3 h anon)
Configuration
odoo.conf
[options] server_wide_modules = base,web,odoo_redis ; ORM Cache (Redis DB 0) ormcache_redis_url = redis://localhost:6379/0 ormcache_redis_expire = 604800 ; Session Store (Redis DB 1) session_redis_url = redis://localhost:6379/1 session_redis_expire = 604800 session_redis_expire_anonymous = 10800 session_redis_prefix = prod
Using two Redis logical databases (0 and 1) lets you flush the ORM cache independently
from sessions: redis-cli -n 0 FLUSHDB
Environment Variables
# Enable Redis session store ODOO_SESSION_REDIS=true ODOO_SESSION_REDIS_URL=redis://localhost:6379/1 ODOO_SESSION_REDIS_PREFIX=prod ODOO_SESSION_REDIS_EXPIRATION=604800 ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS=10800 # Redis Sentinel (HA) ODOO_SESSION_REDIS_SENTINEL_HOST=sentinel-host ODOO_SESSION_REDIS_SENTINEL_PORT=26379 ODOO_SESSION_REDIS_SENTINEL_MASTER_NAME=mymaster
Environment variables take precedence over odoo.conf for session store settings.
Critical: Must Be in server_wide_modules
This module must be listed in server_wide_modules, not just
installed in the database. The session store patch must be in place before the first HTTP
request arrives - before any database is even selected. Installing it as a regular app
is too late; the default filesystem store is already cached.
Odoo.sh Deployment
Odoo.sh doesn't allow sidecar services, so you need an external Redis. The following providers all work out of the box with TLS URLs.
Upstash
Serverless Redis. Free tier (10k commands/day, 256 MB). Recommended for Odoo.sh.
rediss://default:{pass}@{host}:{port}/0
Redis Cloud
Managed Redis by Redis Labs. Free tier 30 MB. Supports TLS and Sentinel.
rediss://:{pass}@{host}:{port}/0
Your Own VPS
Full control. Install Redis on your VPS, firewall port 6379, enable TLS.
rediss://:{pass}@your-vps-ip:6380/0
Odoo.sh odoo.conf example
[options] server_wide_modules = base,web,odoo_redis ormcache_redis_url = rediss://:your_password@your-redis-host:6380/0 ormcache_redis_expire = 604800 session_redis_url = rediss://:your_password@your-redis-host:6380/1 session_redis_expire = 604800 session_redis_expire_anonymous = 10800 session_redis_prefix = prod
Installation
1 Install Python dependency
pip install redis
2 Place module in your addons path
cp -r odoo_redis /path/to/your/addons/
3 Update odoo.conf
Add odoo_redis to server_wide_modules and set your Redis URLs (see Configuration section above).
4 Install the module in Odoo
Go to Apps Update App List Search "Redis Integration" Install.
5 Verify in logs
odoo_redis: Registry.init patched for shared Redis ORM cache odoo_redis: Redis ORM cache active for db='mydb', buckets=[default, assets, ...], TTL=604800s odoo_redis: Redis session store active - prefix='prod', ttl_auth=604800s, ttl_anon=10800s
Custom Development & Version Support
Need This Module for a Different Odoo Version?
We can adapt this module for any Odoo version you need.
Want Custom Features or Modifications?
We provide custom development services to enhance or modify this module to your specific business requirements.
What We Can Do
- Port to any Odoo version
- Redis Cluster support
- Custom cache bucket configuration
- Redis Pub/Sub for cross-process events
- Dashboard to monitor Redis key counts and TTLs
- Integration with your existing Redis infrastructure
Quick Turnaround
- Fast development cycles
- Regular progress updates
- Quality assurance testing
- Documentation included
- Training and support
- Competitive pricing
devpybeans@gmail.com
Support & Warranty
90 Days FREE Support Included!
We provide 90 days of completely FREE support after module installation.
Bug Fixes
Free bug fixes and issue resolution for 90 days
Technical Support
Installation help and configuration assistance
Usage Guidance
Best practices and usage recommendations
Support Period: Starts from the date of module installation
Response Time: Within 24-48 hours on business days
Support Channels: Email, Contact Form, and Direct Communication
Contact Information
Ready to scale your Odoo deployment with Redis? Get in touch!
Website Contact
www.pybeans.com
Contact Form
Developed by PyBeans - Enhancing Odoo for better business solutions.
| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Lines of code | 530 |
| Technical Name |
odoo_redis |
| License | LGPL-3 |
| Website | https://www.pybeans.com |
Please log in to comment on this module