#15255: DB Cache table creation (createcachetable) ignores the DB Router
----------------------------------------+-----------------------------------
Reporter: zvikico | Owner: nobody
Status: new | Milestone:
Component: Cache system | Version: 1.3-beta
Resolution: | Keywords:
Triage Stage: Accepted | Has patch: 1
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 |
----------------------------------------+-----------------------------------
Changes (by aaugustin):
* cc: aaugustin (added)
* has_patch: 0 => 1
Comment:
Attached patch resolves the problem described above.
While writing it, I noticed that `createcachetable` could be much more
automatic. Currently the docs at
http://docs.djangoproject.com/en/dev/topics/cache/#database-caching
suggest first creating the table, then adding the cache backend settings.
Couldn't we do the opposite: first add the cache backend settings, then
create the table? `createcachetable` would go through the cache backends,
find all instances of !BaseDatabaseCache, and create the tables with the
appropriate name, like this:
{{{
from django.conf import settings
from django.core.cache import get_cache
for cache_alias in settings.CACHES:
cache = get_cache(cache_alias)
if isinstance(cache, BaseDatabaseCache):
tablename = cache._table
... create the table ...
}}}
What do you think? Should I create a different ticket for this?
--
Ticket URL: <http://code.djangoproject.com/ticket/15255#comment:2>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.