#34276: LocMemCache not working for multiple threads
-------------------------------------+-------------------------------------
     Reporter:  D Bersan             |                    Owner:  nobody
         Type:  Bug                  |                   Status:  closed
    Component:  Core (Cache system)  |                  Version:  4.1
     Severity:  Normal               |               Resolution:  invalid
     Keywords:  LocMemCache          |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

 * status:  new => closed
 * resolution:   => invalid
 * component:  Uncategorized => Core (Cache system)


Comment:

 > The documentation clearly states:
 >
 > "This cache is **per-process** (see below) and thread-safe."
 > "Note that each process will have its own private cache instance, which
 means no **cross-process caching is possible**. "
 >
 > I have the impression that they meant the cache is **per-thread** , not
 ** per-process** .

 The `LocMemCache` cache is safe -- each process and thread gets its own
 cache, so there's no chances of conflicts (see
 [https://code.djangoproject.com/ticket/7639#comment:3 comment]).

 > ... Both my threads are on the same process, so they should share the
 same caching, according to the documentation ...

 There is nothing in the docs about sharing the same cache instance between
 processes or threads.

 > It also emphasizes, **no cross-process caching is possible**. It doesn't
 say **no cross-threading caching is possible**. But reading other
 resources I found online, it seems this is not shared even among threads,
 so the documentation is wrong, or there is a bug in this version of
 Django.

 I would argue that documentation doesn't need to mention everything that
 it's not possible. It's also documented:

 > ''"To provide thread-safety, a different instance of the cache backend
 will be returned for each thread."''

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34276#comment:3>
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070185de1e41d5-2665a6a0-f4c5-4b81-9263-919adf3e7be6-000000%40eu-central-1.amazonses.com.

Reply via email to