Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(2)  |  Call(0)  |  Derive(0)  |  Import(2)

src/d/j/django-cached-hitcount-0.1.9/cached_hitcount/tasks.py   django-cached-hitcount(Download)
 
from cached_hitcount.utils import get_hitcount_cache, is_cached_hitcount_enabled
from cached_hitcount.settings import CACHED_HITCOUNT_CACHE, CACHED_HITCOUNT_CACHE_TIMEOUT, CACHED_HITCOUNT_IP_CACHE
from cached_hitcount.models import Hit
 
            content_types = {}#used for keeping track of the content types so DB doesn't have to be queried each time
            for cache_key in keys:
                if "hitcount__" in cache_key and not CACHED_HITCOUNT_IP_CACHE in cache_key:
                    cache_key = cache_key.split(':')[-1]#the key is a combination of key_prefix, version and key all separated by : - all we need is the key
                    count = hitcount_cache.get(cache_key)

src/d/j/django-cached-hitcount-0.1.9/cached_hitcount/models.py   django-cached-hitcount(Download)
from django.dispatch import Signal
 
from cached_hitcount.settings import CACHED_HITCOUNT_IP_CACHE_TIMEOUT, CACHED_HITCOUNT_IP_CACHE
from cached_hitcount.utils import get_hitcount_cache, get_target_ctype_pk
# SIGNALS #
    def set_cache(self):
        hitcount_cache = get_hitcount_cache()
        blacklist_ips = list(self.get_query_set().values_list('ip',flat=True))
        hitcount_cache.set(CACHED_HITCOUNT_IP_CACHE, blacklist_ips, CACHED_HITCOUNT_IP_CACHE_TIMEOUT)
        return blacklist_ips
 
    def get_cache(self):
        hitcount_cache = get_hitcount_cache()
        blacklist_ips = hitcount_cache.get(CACHED_HITCOUNT_IP_CACHE)