A project for kvalchemy
Project description
KVAlchemy
KVAlchemy is a SQLAlchemy-based key-vault store. It has the ability to get/set values based off a string key, an optional string tag, and an optional expiration time. Additionally it has a built-in ability to memoize function results to the store.
Example
from kvalchemy import KVAlchemy
# Setup. Supports any available sqlalchemy backend.
k = KVAlchemy('sqlite://')
# Set/Get
k.set("hello", "world")
assert k.get("hello") == "world"
# Default values
assert k.get("hello again", "default") == "default"
# memoize example
import time
@k.memoize()
def func():
time.sleep(1)
func() # Will sleep
func() # Won't sleep
func.cache_clear()
func() # Will sleep
# proxy example
proxy = k.get_proxy('pizza')
proxy.set('pie')
assert proxy.get() == 'pie'
proxy.delete()
assert proxy.get('default') == 'default'
Installation
On Python 3.8 or later:
pip install kvalchemy
More Documentation
For more documentation visit: https://csm10495.github.io/kvalchemy
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
kvalchemy-0.0.3.tar.gz
(8.7 kB
view hashes)
Built Distribution
Close
Hashes for kvalchemy-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b4ced7c9c61745088508997b7fd34f6ead49ac10e32737e0d898e49217dbd3d |
|
MD5 | fc692a2fe883d86e3d4fbb53564987d9 |
|
BLAKE2b-256 | 972e7af09de1c584a61bcab53ece52d87aff9a934894f21d278a14f40f21cfc0 |