Skip to main content

Redis Facade

Instalación

pip3 install redisfacade

Manual de uso

  1. Variables de Entorno
Variable Tipo de dato
REDIS_HOST string
REDIS_PORT int
REDIS_PASSWORD string
  1. Funciones:

    • set_key_value(db: int, key:str, value: Any) -> bool: Este método permite guardar en redis un tipo de dato key - value.
    • get_key_value(db: int, key: str, ttl: timedelta) -> Any: Este método permite obtener un tipo de dato key - value.
    • set_list_str(db: int, list_name: str, intems: List[str]) -> bool: Este método permite guartar un tipo de dato lista de string.
    • get_list_str(db: int, list_name: str) -> List[str]: Este método permite obtener una lista de string completa.
    • pop_list_str(db: int, list_name: str) -> str: Este método permite hacer pop del primer elemento en una lista.
    • len_list(db: int, list_name: str) -> str: Este método permite ver el tamaño de una lista.
    • set_json_data(db: int, json_name, json_key, json_data: Any, ttl: timedelta) -> bool: Este método permite guardar un objeto de tipo json.
    • get_key_json_data(self, db: int, json_name: str, json_key: str) -> Any: Este método permite obtener una llave de objeto de tipo json.
    • def get_json_data(self, db: int, json_name: str) -> Any: Este método permite obtener un objeto de tipo json.
  2. Ejemplos de Uso

from redisfacade.facade import RedisFacade
from typing import Any

if __name__ == "__main__":
   # inicializar singleton
   redisdb = RedisFacade()

   # guardar datos de tipo clave - valor
   redisdb.set_key_value(0, "hola", "mundo", ttl=timedelta(days=3))

   # obtener datos de clave en especifico
   value: Any = redisdb.get_key_value(0, "hola")
   print(value)

   # guardar datos en lista
   is_save: bool = redisdb.set_list_str(0, "mylist", ["hola", "mundo", "beetmann"])
   print(is_save)

   # obtener datos de lista
   list = redisdb.get_list_str(0, "mylist")
   print(list)

   # pop del primer elemento de la lista
   list = redisdb.pop_list_str(0, "mylist")
   print(list)

   # tamaño de lista
   print(redisdb.len_list(0, "mylist"))

   # Guardar dato de tipo json
   is_saved: bool 
   is_saved = redisdb.set_json_data(0, "json_1", "1", "hola_mundo", ttl=timedelta(days=3))
   print(is_saved)
   # obtener dato de tipo json
   is_saved = redisdb.set_json_data(0, "json_1", "2", {"hola": "mundo"}, ttl=timedelta(days=3))
   print(is_saved)

   # obtine una llave de un json
   json_value_1 = redisdb.get_key_json_data(0, "json_1", "3", ttl=timedelta(days=3))
   print(json_value_1)

   # obtine un json completo
   json_value = redisdb.get_json_data(0, "json_1")
   print(json_value)

By: Alan Medina ⚙️

Metadata

Release files for redisfacade 1.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for redisfacade 1.0.7
File Size Uploaded Provenance
redisfacade-1.0.7.tar.gz 4.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for redisfacade 1.0.7
File Interpreter ABI Platform
redisfacade-1.0.7-py3-none-any.whl Python 3 none any Details

Total release size: 9.5 kB

Release files / redisfacade-1.0.7.tar.gz

Download URL redisfacade-1.0.7.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4bb1999db1e2f4cdf822c643226fdd42a7c6bba0c2821bb6ec4dab2f31b13f67
BLAKE2b-256 checksum
How to use checksums
601eace1fc707325bdd9546daf4b5d9f317f9ba708de0610ea2aa20f39fc5fef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.8.10

Release files / redisfacade-1.0.7-py3-none-any.whl

Download URL redisfacade-1.0.7-py3-none-any.whl
Size 5.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9fd533b9c1391e562ab780d4d57112eec4a41fd755f4df97e7762944d868c6d3
BLAKE2b-256 checksum
How to use checksums
b01580b9b5e1ff8ca100fe6ca31d76548169fc7150a93097d15bd7cd65e144d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.8.10

Security for redisfacade 1.0.7

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page