#21012: Provide shared "caches" dict to avoid creating multiple cache class
instances.
--------------------------------------+------------------------------------
Reporter: FunkyBob | Owner: FunkyBob
Type: Cleanup/optimization | Status: assigned
Component: Core (Cache system) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by apollo13):
* cc: apollo13 (added)
Comment:
Replying to [comment:5 jezdez]:
> {{{
> from django.core.cache import caches, default_cache
>
> assert caches['default'] == default_cache
> assert caches['staticfiles'] != default_cache
> }}}
So basically the same we do for ''django.db.connection/s'' -- +1 to
streamline those two implementations
> {{{
> with cache('default') as context_default_cache:
> assert context_default_cache == default_cache
> }}}
While this does look neat, I am not sure about the gain, eg it wouldn't
effect called subfunctions etc (unless that contextmanager changes it in
the thread local -- which is probably not what you want).
--
Ticket URL: <https://code.djangoproject.com/ticket/21012#comment:6>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/066.25897908ddedcbd7e97d9c2308eea611%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.