Tornado session
Environment
python version: >= 3.4
backend: redis,memcache,disk
required: tornadis, tornado, asyncmc
Installation
$ python3.x setup.py install
or
$ pip3.x install tornasess
Quickstarted
create session instance
from tornado import ioloop,gen
from tornasess import SessionCacheFactory
config = {
"host":"localhost",
"port":6379,
}
sess_fac = SessionCacheFactory("redis", config)
# or
# config = {
# "host":["192.168.0.1","192.168.0.2"],
# "port":[4000,5000]
# }
# sess_fac = SessionCacheFactory("memcache", config)
#
#
# or
# config = {"root":"/tmp"}
# sess_fac = SessionCacheFactory("disk", config)
#
session = sess_fac.get_session()
set session data
yield session.start()
session['name'] = 'xxxxx'
session.set("age",100)
session.multi_set({"address":"xxxx","sex":"xxx"})
yield session.end(expires=3600)
get session data
session_id = "GU3ZTM2YTA5ZWViNDE4MTgzM2Q3MzhhMjdjY2IyOWU="
yield session.start(session_id)
session['name']
session.get('name')
session.multi_get(['address','age','name'])
session.all()
#check session field existence
print('name' in session)
#get session id
session.session_id
#Note here!!
# if you don't make change to session data,
# it's not necessary to call 'session.end()'
delete session data
session_id = "GU3ZTM2YTA5ZWViNDE4MTgzM2Q3MzhhMjdjY2IyOWU="
yield session.start(session_id)
session.delete("name")
del session['age']
yield session.end()
destroy session
session_id = "GU3ZTM2YTA5ZWViNDE4MTgzM2Q3MzhhMjdjY2IyOWU="
yield session.start(session_id)
session.destroy()
yield session.end()
cache session instance
# after you used session ,you can cache it to cache factory
sess_fac.cache(session)
Version
0.1
LICENSE
Metadata
Release files for tornasess 0.6
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 |
|---|---|---|---|---|
| tornasess-0.6.tar.gz | 5.3 kB | Without provenance | Details for tornasess-0.6.tar.gz |
Release files / tornasess-0.6.tar.gz
| Download URL | tornasess-0.6.tar.gz |
|---|---|
| Size | 5.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e7fab9b533a923342728056588393ca96e2d2571b6df7666958293af31a0bbc5
|
|
BLAKE2b-256 checksum How to use checksums |
531ab004a8af1123abb4f4d9e5d433ab40ae73236687f97f7ac77b3a7b45b6a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for tornasess 0.6
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.