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,
    'key_prefix': b'myapp-',
}

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.

  • 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.4.tar.gz (2.1 kB view details)

Uploaded Source

Built Distribution

Flask_PyMemcache-0.0.4-py2.py3-none-any.whl (3.9 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

File hashes

Hashes for Flask-PyMemcache-0.0.4.tar.gz
Algorithm Hash digest
SHA256 2411563f0f8335dcee89b34091f2274f7a1b0dcccb64584904418b657e961c11
MD5 dc27013279d4129a1a5511343d9b0178
BLAKE2b-256 6cf57fbb90f9d23992f099ed91ea4a7db9b23a640523f67d521b00c4f64a70e0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for Flask_PyMemcache-0.0.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 5d1d5d7db8d042c65507735e615109e328984c758447dc02468336aee8fe9877
MD5 c5815d9fad745a5c1e55e7c7c459f6d0
BLAKE2b-256 e7e9ad064cd529b583ce5f552d3f91283c79cc3531d6db8302adbee3a9ee78f1

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