'Remove random cache entries if max_entries is reached at a ratio
of num_entries / cull_frequency. A value of 0 for CULL_FREQUENCY means
that the entire cache will be purged.'

def _cull(self):

    filelist = self._list_cache_files()
    num_entries = len(filelist)
    if (num_entries < self._max_entries):
        return
    if (self._cull_frequency == 0):
        return self.clear()
    filelist = random.sample(filelist, int((num_entries / self._cull_frequency)))
    for fname in filelist:
        self._delete(fname)
