A file storage management package supporting various providers like S3, OSS, and Qiniu.
Project description
efcCache
efcCache 是一个通用的缓存类库,支持多种存储后端,包括:
- 本地文件
- SQLite
- MySQL
- PostgreSQL
- Redis
安装
使用 pip 安装 efcCache:
pip install efcCache
快速开始
以下是一个使用 efcCache 的简单示例:
import efcCache
from efcCache.providers.FileCache import FileCache
from efcCache.providers.RedisCache import RedisCache
from efcCache.providers.SQLiteCache import SQLiteCache
from efcCache.providers.MySQLCache import MySQLCache
from efcCache.providers.PostgreSQLCache import PostgreSQLCache
# 创建缓存管理器
manager = efcCache.CacheManager(default_storage="local")
# 设置存储后端
manager.set_storage("local", FileCache(storage_path="./storage/"))
manager.set_storage("redis", RedisCache(host="localhost", port=6379, db=0))
manager.set_storage("sqlite", SQLiteCache(storage_path="./storage/sqlite.db"))
manager.set_storage("mysql", MySQLCache(connection_string="mysql://root:password@localhost:3306/test", table="cache"))
manager.set_storage("postgresql", PostgreSQLCache(connection_string="postgresql://postgres:password@localhost:5432/test", table="cache"))
# 使用示例
manager.set("key", "value")
print(manager.get("key"))
print(manager.exists("key"))
manager.delete("key")
# 直接访问特定存储后端
manager.get_storage("redis").get("key")
manager.get_storage("mysql").get("key")
贡献
欢迎贡献代码、报告问题或提出改进建议。请查看我们的贡献指南了解更多信息。
许可证
efcCache 使用 MIT 许可证。详情请见 LICENSE 文件。
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
efccache-0.0.2.tar.gz
(5.4 kB
view details)
Built Distribution
File details
Details for the file efccache-0.0.2.tar.gz
.
File metadata
- Download URL: efccache-0.0.2.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 02cb79968dee1ed1ad43c07425aa5a044e3f072b2af29eb278840729e3fe2dcd |
|
MD5 | b857744a2d196450e6539e6d38069baf |
|
BLAKE2b-256 | fed7f67a809a794d3877fcdc4be70809cb9658acbb16f3257560aa475c8b461a |
File details
Details for the file efcCache-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: efcCache-0.0.2-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27d1d64e27de4db69d0108ece6f0ac16a1f815bb4de7c137cd2776e293b5471b |
|
MD5 | 813b4dad6a91326158043d4015bc1f3e |
|
BLAKE2b-256 | 03e2c7ecce43ca9b3a555c159aaa661a73cf7b52e0b7d4f8cd71d925a165d4f4 |