Skip to main content

pymemcache integration for Flask

Project description

Install

Install from https://pypi.org/project/Flask-PyMemcache/

pip install Flask-PyMemcache

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

Uploaded Source

Built Distribution

flask_pymemcache-0.0.6-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file flask_pymemcache-0.0.6.tar.gz.

File metadata

  • Download URL: flask_pymemcache-0.0.6.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.1

File hashes

Hashes for flask_pymemcache-0.0.6.tar.gz
Algorithm Hash digest
SHA256 e615c28861a75ad64225cce00102d7549946fc6a3ac8bcef2f8a4b6e51639cd2
MD5 9db51e221b7155cbd5badc4ed1c3e286
BLAKE2b-256 b13c019333cae9a0b33d407681851f13e3f8eb928e6796afafd71e4a38a73b74

See more details on using hashes here.

File details

Details for the file flask_pymemcache-0.0.6-py3-none-any.whl.

File metadata

File hashes

Hashes for flask_pymemcache-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 3bc7d0c7962b7fb4adc04d31d9857977170c6c1b9a9f58ca292b4daeb4bfa2a2
MD5 feed0cc39bac15bfba0bab9ad121eeea
BLAKE2b-256 2fc77a65b41ad8538fa558bb36da6b6e051495f85a45855e6d1bab7a802ee4c3

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