Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Use memcache for store session data

Project Description
Flask memcache session

Store session data in memcache


For install you can use pip:
pip install flask_memcache_session

from flask.ext.memcache_session import Session
from werkzeug.contrib.cache import MemcachedCache
from flask import Flask, session

app = Flask(__name__)
app.cache = MemcachedCache([host, port])
app.session_interface = Session()

def main():
session['x'] = 'The data saved in memcached'


def before_request():
g.db = connect(...)
user = g.db.query(models.Users).get(u.decode(session.get('uid', -1)))
g.is_auth = True if user is not None else False

def after_request(response):
if session.modified and g.is_auth:
user = g.db.query(m.Users).get(u.decode(session.get('uid')))
return response
Release History

Release History

This version
History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
flask-memcache-session-2.0.tar.gz (1.8 kB) Copy SHA256 Checksum SHA256 Source Sep 9, 2013

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting