Skip to main content

pymemcache integration for Flask

Project description

https://travis-ci.org/KLab/Flask-PyMemcache.png

Initialize

memcache = FlaskPyMemcache(app)

or:

memcache = FlaskPyMemcache()
memcache.init_app(app)

Configuration

Put kwargs for pymemcache to PYMEMCACHE in your Flask configuration.

PYMEMCACHE = {
    'server': ('localhost', 11211),
    'connect_timeout': 1.0,
    'timeout': 0.5,
    'no_delay': True,
}

You can use different config key with conf_key keyword:

session = FlaskPyMemcache(conf_key='MEMCACHE_SESSION')
cache = FlaskPyMemcache(conf_key='MEMCACHE_CACHE')

session.init_app(app)
cache.init_app(app)

In addition to normal pymemcache kwargs, Flask-PyMemcache provides following configuration options.

  • prefix – Add prefix to all key. (Default: b’’)

  • close_on_teardown – Close connection to memcached when app teardown.

Use

memcache.client.set('foo', 'bar')

Project details


Download files

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

Source Distribution

Flask-PyMemcache-0.0.3.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

Flask_PyMemcache-0.0.3-py2.py3-none-any.whl (4.1 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file Flask-PyMemcache-0.0.3.tar.gz.

File metadata

File hashes

Hashes for Flask-PyMemcache-0.0.3.tar.gz
Algorithm Hash digest
SHA256 cca2748c0096284f2a1f31be9ca04feed2ed2e4379f49c320bf86e2d0a5c9008
MD5 0a538e55dfc40961efb5053513ab44c3
BLAKE2b-256 a3c5fe5b4a696b1f8ec3bc37f25e84b9ac061fc34c2d80dc006288d5f0eaf036

See more details on using hashes here.

File details

Details for the file Flask_PyMemcache-0.0.3-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for Flask_PyMemcache-0.0.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f6c4825562fddd1a0b31e83f3912d4ffbd2fa63d1765e3137225dec4203f5656
MD5 325f5740d2f36c6365467e699ebd5acb
BLAKE2b-256 7daa4862fb9e8a62c1d17730c5ad12a10d24afb9ec8adb3db035ac20189ab5d0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page