0

I am hosting two sites from my Django code base and I am using Johnny Cache for caching.

I have individual settings.py and manage.py for both the sites.

I have configured Johnny Cache for both of them. Now, what is required is that they share the cache. All in all, it is required that if something is changed on Site1, the same should reflect on Site2 (using cache).

I have tried many things like defining the CACHES, CACHE_BACKEND, JOHNNY_MIDDLEWARE_KEY_PREFIX, CACHE_PREFIX settings. But all in vain.

I think I am missing something, but can not figure it out.

UPDATE:

The settings:

CACHES = {
    'default': {
        'BACKEND': 'johnny.backends.locmem.LocMemCache',
        'LOCATION': 'project-default',
        'JOHNNY_CACHE': True
    }
}

CACHE_BACKEND = 'default'
JOHNNY_MIDDLEWARE_KEY_PREFIX='jc_pc'

CACHE_TIMEOUT = 10000
CACHE_PREFIX = 'pc'
Sandip Agarwal
  • 1,890
  • 5
  • 28
  • 42

1 Answers1

1

You're using the Local memory cache which means that the cache data is restricted to whatever process is serving your site. If you want to share cache data between different sites, you'll need to use something like memcached or file-system caching.

Dominic Rodger
  • 97,747
  • 36
  • 197
  • 212