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.1.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

Flask_PyMemcache-0.0.1-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.1.tar.gz.

File metadata

File hashes

Hashes for Flask-PyMemcache-0.0.1.tar.gz
Algorithm Hash digest
SHA256 97e9108c0b4714159994d23d9e914dbb6c889f501f5f18fafae3b943c3594065
MD5 604cab8a33d6d2ee8e71c5974373fa4d
BLAKE2b-256 be29bd9d8b6a8596183649704a32cb9b00f97747fe2762de7297a82c5aa64e1e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for Flask_PyMemcache-0.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 dbce9831c08642f164abd3dd0076f59f58f2c03e2e70b8ad16efa6d76b9e2f45
MD5 5ce83c8a7a716b0afaa524782380562b
BLAKE2b-256 9963ae3c499481aff5ce36f0e613004f13a892e42d3f3119269dd557d76494ea

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