My toolbox
Project description
hwhpykit
- 依据个人习惯封装的常用第三方库
- 依赖的第三方库:
Main function
-
Cache
- Redis-client
- string
- list
- hash
- set
- zset
- geo
- server
- subscribe
- transaction
- Redis-client
-
Buffer
Kafka-client
RabbitMQ-client
RocketMQ-client
- DataBase
MySQL-client
PostgreSQL-client
Cache
Redis-client
from hwhpykit.cache.reids.RedisManager import RedisManager
RedisManager.config(host="127.0.0.1", db=0)
string
RedisManager.string.set("reids", "value")
RedisManager.string.set_keys({"a":1, "b": 2})
RedisManager.string.set_range("redis", 6, "666")
RedisManager.string.set_not_exist_key('11', "1222")
RedisManager.string.append('redis', '---')
key = 'redis'
r = RedisManager.string.get(key)
r = RedisManager.string.get_len(key)
r = RedisManager.string.get_range(key, 0, -1)
r = RedisManager.string.get_values(['11', "1222"])
RedisManager.string.set('2', '0')
RedisManager.string.increase('2')
RedisManager.string.increase('2', -100000)
r = RedisManager.string.get('2')
hash
key = "redis-hash"
RedisManager.hash.set_map(key, {"louis1": "1", "louis2": "2"})
RedisManager.hash.set_value(key, "louis3", "3")
RedisManager.hash.set_not_exits_value(key, "louis3", "4")
r = RedisManager.hash.get_all(key)
RedisManager.hash.delete_field(key, "louis1")
RedisManager.hash.increase_field_int(key, "louis3", 100)
RedisManager.hash.increase_field_float(key, "louis2", 100.000001)
r = RedisManager.hash.get_all(key)
r = RedisManager.hash.get_all_keys(key)
r = RedisManager.hash.get_all_values(key)
r = RedisManager.hash.get_all_key_count(key)
r = RedisManager.hash.get_value_bytes_len(key, "louis2")
r = RedisManager.hash.scan(key, cursor=0, pattern="louis2", count=10)
set
key = "test_set"
key1 = "test_set_1"
key2 = "test_set_2"
key3 = "test_set_3"
RedisManager.set.add(key1, 1, 2, 3)
RedisManager.set.add(key2, 1, 2, 3, 4, 5, 6)
RedisManager.set.add(key3, 1, 2, 3, 7, 8, 9)
RedisManager.set.remove(key, 1, 2, 3)
RedisManager.set.count(key)
RedisManager.set.difference(key2, key3)
RedisManager.set.intersection(key2, key3)
RedisManager.set.union(key2, key3)
RedisManager.set.is_member(3, key3)
RedisManager.set.get_all_value(key3)
GEO
key = "test-geo-key"
RedisManager.geo.add(key, 1, 1, 'a1')
RedisManager.geo.add(key, 2, 1, 'a2')
RedisManager.geo.get_location(key, 'a')
distance = RedisManager.geo.distance(key, 'a1', 'a2')
locations = RedisManager.geo.radius_locations(key, 0, 0,300, withdist=True, withcoord=True, sort='ASC')
locations = RedisManager.geo.radius_locations_by_member(key, 'a1', 300, withdist=True, withcoord=True, sort='ASC')
location_hash = RedisManager.geo.hash(key, 'a1', 'a2')
Database
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file hwhpykit-1.0.8.tar.gz
.
File metadata
- Download URL: hwhpykit-1.0.8.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44f3d8123760d584a15a73d33ece02b7d593289aa1c05cbf394c6776a2992c9a |
|
MD5 | a386e4bbe7a6c7be1f050b1b3e820070 |
|
BLAKE2b-256 | 4ee0a22a641cc1e52f0f4262ff521171c2e8f725f9b47ecac6f0c754d8c58332 |
File details
Details for the file hwhpykit-1.0.8-py3-none-any.whl
.
File metadata
- Download URL: hwhpykit-1.0.8-py3-none-any.whl
- Upload date:
- Size: 22.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc9a21b1f02dc0423bbfea76f1eb3278bd41e21704c877c502f213266ffc44a1 |
|
MD5 | d3510a22b08d0b8d9cbccf92e112dd9a |
|
BLAKE2b-256 | 359e3ab09f2ea2f70fb097e96500cdbcc8d42ee49e734b549f43ead388b34c18 |