﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
23642	LocMemCache.incr is not thread safe	Thomas C	nobody	"`LocMemCache` is documented as being thread-safe, but its `incr` operation isn't: there is no lock wrapping the whole get+set operation.

The code below demonstrates the issue:

{{{
import threading

from django.core.cache.backends.locmem import LocMemCache

cache = LocMemCache('test', {})

cache.set('foo', 0)

def increment(key):
    cache.incr(key)

threads = []
for i in range(20):
    t = threading.Thread(target=increment, args=('foo',))
    t.start()
    threads.append(t)

for t in threads:
    t.join()

print cache.get('foo')   # Random results — 20 is expected
}}}
"	Bug	new	Core (Cache system)	dev	Normal				Unreviewed	0	0	0	0	0	0
