示例#1
0
    def clear(self, key, participant_identifier):
        try:
            # Remove the direct entry
            cache_key = COUNTER_CACHE_KEY % key
            freq = Count.get(cache_key, participant_identifier)
            Count.deletefield(cache_key, participant_identifier)

            # Remove from the histogram
            freq_cache_key = COUNTER_FREQ_CACHE_KEY % key
            Count.next(freq_cache_key, freq, -1)
        except:
            # Handle Redis failures gracefully
            pass