mirror of
https://github.com/MISP/misp-galaxy.git
synced 2024-11-30 02:37:17 +00:00
94 lines
2.2 KiB
Text
94 lines
2.2 KiB
Text
Metadata-Version: 2.1
|
|
Name: sponge
|
|
Version: 0.0.8
|
|
Summary: An elegant cache library for python
|
|
Home-page: https://github.com/IamBusy/sponge
|
|
Author: William Wei
|
|
Author-email: 1342247033@qq.com
|
|
Maintainer: William Wei
|
|
Maintainer-email: 1342247033@qq.com
|
|
License: GNU Lesser General Public License v3 (LGPLv3)
|
|
Platform: all
|
|
Classifier: Development Status :: 4 - Beta
|
|
Classifier: Operating System :: OS Independent
|
|
Classifier: Intended Audience :: Developers
|
|
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
Classifier: Programming Language :: Python
|
|
Classifier: Programming Language :: Python :: Implementation
|
|
Classifier: Programming Language :: Python :: 3.3
|
|
Classifier: Programming Language :: Python :: 3.4
|
|
Classifier: Programming Language :: Python :: 3.5
|
|
Classifier: Programming Language :: Python :: 3.6
|
|
Classifier: Topic :: Software Development :: Libraries
|
|
License-File: LICENSE
|
|
Requires-Dist: redis >=2.10.6
|
|
|
|
`Build Status <https://travis-ci.org/IamBusy/sponge>`__ `PyPI - Python
|
|
Version <https://pypi.org/project/sponge/#description>`__ `PyPI -
|
|
License <https://pypi.org/project/sponge/#description>`__ `Codecov
|
|
branch <https://codecov.io/gh/IamBusy/sponge>`__
|
|
|
|
sponge
|
|
======
|
|
|
|
An elegant cache library for python
|
|
|
|
How to use
|
|
==========
|
|
|
|
Install
|
|
~~~~~~~
|
|
|
|
.. code:: bash
|
|
|
|
pip install sponge
|
|
|
|
Usage
|
|
~~~~~
|
|
|
|
.. code:: python
|
|
|
|
from sponge import CacheManager
|
|
|
|
# config cache manager
|
|
manager = CacheManager({
|
|
'default': 'redis',
|
|
'redis': {
|
|
'host': 'localhost',
|
|
'port': 3306,
|
|
'db': 0
|
|
},
|
|
'memory': {}
|
|
})
|
|
|
|
# get cache instance
|
|
cache = manager.store('redis')
|
|
|
|
# set cache
|
|
cache.put('mykey', 'myvalue', 30) # 30 seconds
|
|
cache.get('mykey') # myvalue
|
|
|
|
# remove cache
|
|
cache.forget('mykey')
|
|
|
|
# cache fover
|
|
cache.fover('mykey', 1)
|
|
|
|
# increase
|
|
cache.increase('mykey') # the value will be 2
|
|
|
|
# decrease
|
|
cache.decrease('mykey', 2) # the value will be -1
|
|
|
|
|
|
# clear all
|
|
cache.flush()
|
|
|
|
TODO
|
|
====
|
|
|
|
- [ ] Support cache events
|
|
- [ ] Support file driver
|
|
- [ ] Support database driver
|
|
- [ ] Added into
|
|
`awesome-python <https://github.com/vinta/awesome-python>`__
|