示例#1
0
def clear_latest_comments_memcache(id=None):
	keys = ['latest_comments:%s' % LATEST_COMMENTS_FOR_SIDEBAR, 'latest_comments:%s' % LATEST_COMMENTS_FOR_FEED]
	if id:
		keys.extend(['get_comments_with_user_by_article_key:%s_True_None' % id, 'get_comments_with_user_by_article_key:%s_False_None' % id])
	memcache_client.delete_multi_async(keys)
	tenjin.helpers.fragment_cache.store.delete('siderbar')
	yui.flush_all_server_cache()
示例#2
0
def clear_article_memcache(id=None, url=None):
	keys = ['get_articles_for_feed', 'get_articles_for_homepage']
	if id:
		keys.append('get_article_by_id:%s' % id)
		tenjin.helpers.fragment_cache.store.delete('article:%s' % id)
	if url:
		keys.append('get_article_by_url:%s' % hash(url))
	memcache.delete_multi(keys)
	yui.flush_all_server_cache()
示例#3
0
def clear_article_memcache(id=None, url=None):
    keys = ['get_articles_for_feed','get_articles_for_homepage']
    if id:
        keys.append('get_article_by_id:%s' % id)
        fragcache.store.delete('article:%s' % id)
    if url:
        keys.append('get_article_by_url:%s' % hash(url))
    memcache_client.delete_multi_async(keys)
    yui.flush_all_server_cache()
示例#4
0
	def post(self):
		path_with_name = Category.fill_pathes(self.POST['path'])
		if not path_with_name:
			self.write('Add failed, the category name cannot be empty.')
			return

		try:
			keys = ['get_all_categories']
			for each_path, name in path_with_name:
				if Category.all().filter('path =', each_path).count(1):
					continue
				category = Category.get_by_key_name(name)
				if category and category.path != each_path:
					self.write('Add failed, there is already a path "%s" includes the category name "%s".' % (category.path, name))
					return
				Category.get_or_insert(key_name=name, path=each_path)
				keys.extend(['get_sub_categories:' + name, 'get_category_with_subs:%s' % hash(each_path)])
			memcache.delete_multi(keys)
			tenjin.helpers.fragment_cache.store.delete('siderbar')
			yui.flush_all_server_cache()
			self.write('Add successful.')
		except:
			self.write('Add failed, the datastore has some error or is busy now.')
示例#5
0
文件: admin_view.py 项目: srijib/gae
	def get(self):
		yui.flush_all_server_cache()
		memcache.flush_all()
		self.write('缓存已清空')
示例#6
0
	def get(self):
		yui.flush_all_server_cache()
		memcache.flush_all()
		self.write('Caches has been flushed.')
示例#7
0
def clear_categories_memcache():
	memcache.delete('get_all_categories')
	tenjin.helpers.fragment_cache.store.delete('siderbar')
	yui.flush_all_server_cache()