Skip to content

Instantly share code, notes, and snippets.

@esisa
Created October 24, 2012 08:31
Show Gist options
  • Save esisa/3944837 to your computer and use it in GitHub Desktop.
Save esisa/3944837 to your computer and use it in GitHub Desktop.
Clear a elevation profile cache
from django.conf import settings
# Cache location set to file
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
'LOCATION': '/tmp/waymarkedtrails-cache',
}
}
settings.configure(CACHES=CACHES)
from django.core.cache import cache
from django.http import HttpRequest
from django.utils.cache import get_cache_key
from django.core.urlresolvers import reverse
def expire_page(relation_id):
jsonRequest = HttpRequest()
jsonRequest.path = "/en/routebrowser/305572/profile/json"
key = get_cache_key(jsonRequest)
print key
if cache.has_key(key):
cache.delete(key)
#expire_page(305572)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment