Flask-Redislite
Using Flask with Redislite, also redis-collections and rq.
Installation
Using pip
pip install Flask-Redislite
Usage
Choose the path for your Redislite data file, then include to your application config
REDISLITE_PATH = '<path/to/redis/file.rdb>'
Create new redis instance within your application
from flask import Flask
from flask_redislite import FlaskRedis
app = Flask(__name__)
rdb = FlaskRedis(app)
# with redis-collections:
# rdb = FlaskRedis(app, collection = True)
Then use it on your view
rdb.connection.set('foo1', 'bar1')
print rdb.connection.get('foo1')
# redis-collections
collection = rdb.collection
d = collection.dict('123456')
d['foo'] = 'bar'
print d
RQ
To use Flask-Redislite with RQ, you need to start RQ worker as a new process
from flask import Flask
from flask_redislite import FlaskRedis
app = Flask(__name__)
rdb = FlaskRedis(app, rq=True)
# Your other extensions load here
# ex: lm = LoginManager()
# ...
with app.app_context():
rdb.start_worker()
# your codes
# ex: views function
app.run()
Then within your view enqueue the jobs:
import time
def simple_job():
time.sleep(2)
return 12345
queue = rdb.queue
queue['default'].enqueue(simple_job, ttl=60, result_ttl=60, job_id='321')
sleep(5)
print queue['default'].fetch_job('321').result
History
0.1.1 (07/11/2017)
Update README.rst
Upgrade library
0.1.0 (31/8/2016)
Support multiple queue
0.0.5 (9/7/2016)
Better test coverage
Apply PEP8
Resume lost Redislite process on restart, interrupted exit
0.0.4 (6/7/2016)
Add test
0.0.3 (5/7/2016)
Implement RQ
0.0.2 (3/7/2016)
Add documents
Fix minor codes
0.0.1 (2/7/2016)
Initial package
Allow to use Redislite and redis-collections from Flask
Metadata
Release files for Flask-Redislite 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| Flask-Redislite-0.1.1.tar.gz | 5.0 kB | Without provenance | Details for Flask-Redislite-0.1.1.tar.gz |
Release files / Flask-Redislite-0.1.1.tar.gz
| Download URL | Flask-Redislite-0.1.1.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1d2f6532b41788b1c5d818aa4b37ea66630f514f03de0781e5a170862dff22f4
|
|
BLAKE2b-256 checksum How to use checksums |
7ed068ff665271856a0a190b33c250160b514c155332270bd54a1cc8867d78ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for Flask-Redislite 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.