Example #1
0
    def get_cached_profile(self, screen_name):
        cache = Cache.all()
        cache.filter('name =', 'profile:' + screen_name.lower())
        cache = cache.get()

        outdated = False

        # Let's see if it's outdated, give it 1 hour
        if cache:
            if cache.published + timedelta(hours=1) < datetime.now():
                outdated = True

        # Return a tuple. Beware ;)
        return (cache, outdated)
Example #2
0
	def get_cached_profile(self, screen_name):
		cache = Cache.all()
		cache.filter('name =', 'profile:' + screen_name.lower())
		cache = cache.get()
		
		outdated = False
		
		# Let's see if it's outdated, give it 1 hour
		if cache:
			if cache.published + timedelta(hours=1) < datetime.now():
				outdated = True

		# Return a tuple. Beware ;)
		return (cache, outdated)
Example #3
0
def do_rebuild(cursor=None):
  cacheq = Cache.all()

  if cursor:
    cacheq.with_cursor(cursor)

  cache = cacheq.get()

  if not cache:
    import logging
    logging.info("stop rebuild")
    return

  if cache.data and not cache.comp:
    cache.comp = cache.data.encode('utf8')
    cache.data = None
    cache.put()

  deferred.defer(do_rebuild, cacheq.cursor())
Example #4
0
def clear_profile_cache(screen_name):
    q = Cache.all()
    q.filter('name =', 'profile:' + screen_name.lower())
    for c in q:
        c.delete()
Example #5
0
def clear_profile_cache(screen_name):
	q = Cache.all()
	q.filter('name =', 'profile:' + screen_name.lower())
	for c in q:
		c.delete()