In my django app, I am using a separate database (not default). And I am selecting it manually by using (using= "database_name")
Now I need to use the django backend cache on that database. For that straight forward approach works only for default database. For a separate database, do we need to write router ? If so, I wrote a router like this in models.py in my app. class CacheRouter(object): """A router to control all database cache operations""" def db_for_read(self, model, **hints): "All cache read operations go to the slave" if model._meta.app_label in ('app',): return 'db_name' return None def db_for_write(self, model, **hints): "All cache write operations go to master" if model._meta.app_label in ('app',): return 'db_name' return None def allow_syncdb(self, db, model): "Only synchronize the cache model on master" if model._meta.app_label in ('app',): return db == 'db_name' return None Is this correct ? If so, how will I know it is working ? I did not reference this in anywhere in settings.py ? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.