django-visitor / visitor /

from django.core.cache import cache

CACHE_TIMEOUT = 60 * 60 * 1 # one hour

def make_cache_key(visitor_key):
    """ make the cache key for visitor """
    return 'visitor_%s' % (visitor_key)

def check_cache(visitor_key):
    """ check the cache for this visitor """
    cached = cache.get(make_cache_key(visitor_key))
    if cached:
       return cached
    return None

def set_cache(visitor):
    """ set the visitor object in the cache """
    if visitor.visitor_key:
        cache_key = make_cache_key(visitor.visitor_key) 
        cache.set(cache_key, visitor, CACHE_TIMEOUT)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.