﻿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
15825	File-based caching doesn't cull truly randomly	gkuenning	nobody	"The culling algorithm in filebased.py uses an essentially random culling method, which is well known to lead to an approximation to LRU.  However, the randomness is improperly applied.  For example, consider a frequently-accessed page that, by luck, happens to sort first in the file list (due to an alphatbetically low hash value).  The culling code will always delete this file, while a truly random algorithm would only do so 1/n of the time.

The fix is easy: at approximately line 131 in filebased.py, ""== 0"" should be replaced with ""== ranno"" where ranno is chosen in the immediately preceding line with:

    ranno = random.randint(0, self._cull_frequency)"	Bug	closed	Core (Cache system)	dev	Normal	fixed		Jaap Roes	Accepted	1	0	0	0	0	0
