Cache-Client
Cache-Client
most of the time, you need cache to some kind of backend to speed up your app.
this framework add these tools to free you from write these.
it also has auto update function to free you from manually update something.
Usage
from logging import StreamHandler
import asyncio
import time
from cache_client.client.common import SimpleClient
import logging
logger = logging.getLogger(__package__)
handler = StreamHandler()
handler.setLevel(logging.DEBUG)
logger.addHandler(handler)
logger.setLevel(logging.DEBUG)
mysql_conf = {
'host': '127.0.0.1',
'port': 3306,
'db': 'test',
'user': 'test',
'password': 'test'
}
redis_conf = {
'redis_host': '127.0.0.1',
'redis_port': 6379,
'redis_secret': '',
}
client = SimpleClient(backend_conf=mysql_conf,
cache_conf=redis_conf,
update_interval=30)
async def test():
await client.connect()
expire_at = int(time.time()) + 100
for i in range(10):
start = int(time.time()*1000)
result = await client.get(
database='sku',
key='select sku_id,description,price,status from sku',
expire_at=expire_at,
update_interval=100)
end = int(time.time()*1000)
print('running time', end-start)
print(result, 'result', i)
loop = asyncio.get_event_loop()
# loop.run_until_complete(test())
loop.create_task(test())
loop.run_forever()
Coding
- like this project, star it
- any suggestion is welcome
- this project is under MIT lisense
more docs are writing.
Metadata
Release files for cache-client 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cache_client-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for cache_client-1.0.0-py3-none-any.whl |
Release files / cache_client-1.0.0-py3-none-any.whl
| Download URL | cache_client-1.0.0-py3-none-any.whl |
|---|---|
| Size | 8.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5282bf8384fae790498e64f00ddb49bba2c8e4fa97d2e30b5e547e9fab7d6dca
|
|
BLAKE2b-256 checksum How to use checksums |
5027f8d5cef5b72e1bd5805c3fe35bba2cb563e89e8b2629e7cfdf41209844ff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3
|
Security for cache-client 1.0.0
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.