Skip to content

How to use memcache with simplekv/ kv-session? #35

@li-gjhawar

Description

@li-gjhawar

I am trying to use memcache with simplekv, But as mentioned in the documentation, I get an IO error when I try to clear the cache (during the cleanup_session() part of the code).

from simplekv.memory.memcachestore import MemcacheStore
import memcache
import redis
import datetime

store = RedisStore(redis.StrictRedis())

store = MemcacheStore(memcache.Client(['127.0.0.1:11211'], debug = 0))
store.ttl_support = True
app = create_app(name)
current_kvsession = KVSessionExtension(store, app)
for key in app.kvsession_store.keys():
logger.debug(key)
m = current_kvsession.key_regex.match(key)
logger.debug('found %s', m)
logger.debug(app.kvsession_store.delete(key))

Since memcache doesnt support app.kvsession_store.keys(). Do I need to remember the key somewhere so that I wont have to pull it out of memcache? Let me know if more explaination is needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions