Mirex
Distributed Redis based caching for discord bots.
Mirex makes no guarantees that objects will be saved and restored field for field. The discord API is too unstable to provide correctness in all cases given how frequently fields are added, removed or changed. If you notice a change please open an issue or PR so it can be updated.
Basic example
Given how early in development this library is, this is an extremely simple POC however it does work.
import asyncio
import os
import disnake
from disnake.ext import commands
from redis import asyncio as aioredis
from mirex import Mirex
async def main():
bot = commands.InteractionBot(intents=disnake.Intents.all())
redis = aioredis.from_url("redis://127.0.0.1:6379")
mirex = Mirex(
namespace=disnake,
redis_instance=redis,
connection_state=bot._connection,
)
mirex.inject_hooks()
asyncio.create_task(mirex.consume_queue())
asyncio.create_task(mirex.consume_eviction())
@bot.event
async def on_ready():
guild_id = ...
g = await bot.fetch_guild(guild_id)
mirex.add_to_cache(g)
guild: disnake.Guild = await mirex.aget_guild(guild_id)
assert guild == g
print("Done")
await bot.start(os.environ["TOKEN"])
asyncio.run(main())
Metadata
Release files for mirex 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| mirex-0.1.0.tar.gz | 5.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mirex-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.4 kB
Release files / mirex-0.1.0.tar.gz
| Download URL | mirex-0.1.0.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3f72602ff3d8a0db4aac54f57bfae1a757ab902573f7d533b21e755b909539a0
|
|
BLAKE2b-256 checksum How to use checksums |
6d4663d92115d59ce67634d5d334dfa62c88fc9bea4074b1db856f0f9ca18a47
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.6
|
Release files / mirex-0.1.0-py3-none-any.whl
| Download URL | mirex-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
772919a7b597e116094819344426e8d94179f3a3130cc7f920ba28e6f4873dd2
|
|
BLAKE2b-256 checksum How to use checksums |
a63add2c65f8c78d43994fbec78c5006324943653ffc5f087fb82a52c3ce59e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.6
|
Security for mirex 0.1.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.