def flush_memcache_content(): mc = memcachedStatic.getMemCache() mc.flush_all()
# encoding: utf-8 import dbhelper_read from datasys.memcachedHelper import memcachedStatic SERVICE_CATEGORY_CACHE_TIMEOUT = 86400 mc = memcachedStatic.getMemCache() def get_sub_categories(category_id): sql = 'select id as category_id, name as category_name from jd_category where id like "%s-%%" and id not like "%s-%%-%%"' % ( category_id, category_id) retrows = dbhelper_read.executeSqlRead(sql) if len(retrows) == 0: sql = 'select id as category_id, name as category_name from jd_category where id like "%s-%%" and id not like "%s-%%-%%-%%"' % ( category_id, category_id) retrows = dbhelper_read.executeSqlRead(sql) # for row in retrows: # row['sub_categories'] = _expand_to_sub_categories(row['category_id']) # print row['category_id'] return retrows def getServiceCategoryList(): mckey = 'category_service.py::getServiceCategoryList' #mv = mc.get(mckey) mv = None if mv is not None: return mv
# encoding: utf-8 import dbhelper_read import sku_index_access,sku_service, service_config from datasys.memcachedHelper import memcachedStatic from worthy_analytics import common_analytics from utils import regex_dict_helper, collection_utils mc = memcachedStatic.getMemCache() P_VALUE_BLACK_LIST = [ u'其他', u'其它', u'不支持',u'支持', u'无', ] P_VALUE_BLACK_LIST_REGEX = [ r'[\\/]+[\w\W]*-', r'[a-z]+\d{2,}[ ]?-', r'\d[.]\d{3,}', r'2[1234]0[ ]?v', r'1[01]0[ ]v', r'\d{5,}', u'℃', u'°[ ]?c', u'\d(摄氏|华氏| )?度', r'[\w\W]+-[\w\W]*-', u'\d+[种个]', r'[a-z0-9]{2,}[ ]?-[ ]?[a-z0-9]{2,}', u'不含', u'的所有',