Beispiel #1
0
def get_mc():
    return mc_from_config(MEMCACHED, use_cache=False)


def stub_cache(*args, **kws):
    pass


mc = get_mc()
pcache = pcache2 = listcache = cache_in_obj = delete_cache = cache = stub_cache
globals().update(create_decorators(mc))


def mc_gets(mc_key, getter, ids):
    '''helpler for gets function'''
    results = mc.get_multi([mc_key % i for i in ids])
    return [results.get(mc_key % i) or getter(i) for i in ids]


# mysql
def connect_mysql():
    return connect(use_unicode=True)


def make_dict(cursor, row):
    return dict(zip((str(d[0]) for d in cursor.description), row))


store = store_from_config(MYSQL_STORE, use_cache=False)
setup(store, mc)
Beispiel #2
0
def mc_gets(mc_key, getter, ids):
    '''helpler for gets function'''
    results = mc.get_multi([mc_key % i for i in ids])
    return [results.get(mc_key % i) or getter(i) for i in ids]


# mysql
def connect_mysql():
    return connect(use_unicode=True)


def make_dict(cursor, row):
    return dict(zip((str(d[0]) for d in cursor.description), row))


def reset_mc():
    pass


def reset_beansdb():
    pass


def clear_local_cache():
    reset_mc()
    reset_beansdb()


store = store_from_config(MYSQL_STORE, use_cache=False)
setup(store, mc)